Tag: remove

  • Remove the elements from array in php

    <?php $String_array=array(“a”,”b”,”c”,”d”); $string_search=”c”; echo “<pre>”; print_r($String_array); /* OUTPUT OF print_r($string_array); Array ( [0] => a [1] => b [2] => c [3] => d ) Now, We have to remove “c” value of element [2] from array */  unset($String_array[array_search($string_search, $String_array)]); /* * From Above code  : * first search the element from the array using…