array fill key use in php project

Solutions on MaxInterview for array fill key use in php project by the best coders in the world

showing results for - "array fill key use in php project"
Michele
04 Jan 2017
1$string = 'hello|wild|world';
2list($hello, , $world) = explode('|', $string);
3echo("$hello, $world"); // hello, world
4
Max
07 Sep 2019
1// define array
2$array = ['a', 'b', 'c'];
3 
4// without list()
5$a = $array[0];
6$b = $array[1];
7$c = $array[2];
8 
9// with list()
10list($a, $b, $c) = $array;
11
Jerónimo
24 Apr 2017
1$arrays = [[1, 2], [3, 4], [5, 6]];
2 
3foreach ($arrays as list($a, $b)) {
4    $c = $a + $b;
5    echo($c . ', '); // 3, 7, 11, 
6}
7