Write a PHP program to filter out some array elements with certain key-names
<?php $first_array = array('c1' => 'Red', 'c2' => 'Green', 'c3' => 'White', 'c4' => 'Black'); $second_array = array('c2', 'c4'); $result = array_diff_key( $first_array, array_flip( $second_array)); print_r($result); ?>
Sample Output:
Array ( [c1] => Red [c3] => White )
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Sample Output:
Array ( [c1] => Red [c3] => White )need an explanation for this answer? contact us directly to get an explanation for this answer