<?php
$keys = array(1,2,3,6,9); //note that 9 does not exist as key in the $values array
$values = array('000', '001', '002', '003', '004', '005', '006', '007');
$new = array_map( function( $key) use( $values) {
return $values[ $key ];
}, array_intersect( $keys, array_keys( $values));
var_dump( $new);
- Output for 5.3.0 - 5.3.19, 5.4.0 - 5.4.9
- Parse error: syntax error, unexpected ';' in /in/efo6E on line 6
Process exited with code 255.
preferences:
173.06 ms | 1395 KiB | 37 Q