-
Notifications
You must be signed in to change notification settings - Fork 0
/
array.php
executable file
·64 lines (47 loc) · 1.11 KB
/
array.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
$links = [2,3,4,5,5,6,7,7,8,8,9,0];
$stringhe = ["a", "b", "f"];
$mixed = array(1, "ciao", 9.4, [2, 4, "stella"]);
$links[2];
$mixed[3][0];
$vuoto = [];
$a = 1;
$b = 4;
$a = $b;
$links = $stringhe;
$stringhe[] = "prova";
$a = $links;
print_r($a);
print_r($links);
print_r($stringhe);
$mixed[] = 10;
$mixed[] = $stringhe;
$mixed = array_merge($mixed, $stringhe);
print_r($mixed);
$input_array = array('a', 'b', 'c', 'd', 'e');
print_r(array_chunk($input_array, 3));
print_r(array_chunk($input_array, 2, true));
$uno = [0,1,2,3,4,5];
$due = ["a","b","c","d","e","f"];
$c = array_combine($uno, $due);
print_r($c);
print_r(array_reverse($c));
$input = array("Neo", "Morpheus", "Trinity", "Cypher", "Tank");
$rand_keys = array_rand($input, 2);
echo $input[$rand_keys[0]] . "\n";
echo $input[$rand_keys[1]] . "\n";
$numbers = range(1, 20);
shuffle($numbers);
foreach ($numbers as $number) {
echo "$number ";
}
/*
* fare prove con array
* vedere hash + metodi php
*
* interfacce
* includere classi php da altri file
*
* metodi magici (?)
*
*/