PROGRAMMING     CLIMBING

  minte9
reminder




Last update:   29-10-2021

List

Assign variables as if they were array.
 
list($a, $b) = array(1, 2);

echo $a; // Output: 1
echo $b; // Output: 2

Each

Returns current key/value and advance the cursor.
 
$arr = array(1,2,3);
$row = each($arr); 

print_r($row); //  [1] => 1 [value] => 1 [0] => 0 [key] => 0 
echo $res['value'];  // 1
 
$arr = array('a', 'b', 'c');

while(list($k, $v) = each($arr)) {
    echo $k . $v;  // 0a 1b 2c
}

Extract

Assign variable from key/value.
 
$array = array('a'=>1, 'b'=>2, 'c'=>3);
extract($array);

echo $b; // Output: 2

Questions    
Array search
        A B C D E F
🔔
1/2