How array() parameter works in array_diff() in php? -
i have example this:
<?php $arr = array(-1,0,1,12,-100,1); print_r($arr); echo "</br>"; $new_arr = array_diff($arr, array(12)); print_r($new_arr); ?>
the "array()" part ("array(12)" in example "keyword" can used grab value in array? not explained in php.net manual, @ least not array_diff. if point me explanation good.
thanks.
array(12) not keyword, array declared value 12 @ index 0. let me re-write , self explanatory.
<?php $arr = array(-1,0,1,12,-100,1); $arr2 = array(12); print_r($arr); echo "</br>"; print_r($arr2); echo "</br>"; $new_arr = array_diff($arr, $arr2); print_r($new_arr); ?>
Comments
Post a Comment