Php Remove String From Array

[Solved] Php Remove String From Array | Php - Code Explorer | yomemimo.com
Question : php remove string from array

Answered by : sam

$index = array_search('string3',$array);
if($index !== FALSE){ unset($array[$index]);
}

Source : https://stackoverflow.com/questions/4120589/remove-string-from-php-array | Last Update : Sun, 14 Nov 21

Question : PHP remove value from array

Answered by : tristian-potgieter

array_diff( [312, 401, 15, 401, 3], [401] ) // removing 401 returns [312, 15, 3]
// https://stackoverflow.com/questions/7225070/php-array-delete-by-value-not-key#:~:text=with%20one%20element.-,array_diff(%20%5B312%2C%20401%2C%2015%2C%20401%2C%203%5D%2C%20%5B401%5D%20)%20//%20removing%20401%20returns%20%5B312%2C%2015%2C%203%5D,-It%20generalizes%20nicely

Source : https://stackoverflow.com/questions/7225070/php-array-delete-by-value-not-key | Last Update : Thu, 05 May 22

Question : PHP remove value from array

Answered by : tristian-potgieter

array_diff( array(312, 401, 15, 401, 3), array(401) ) // removing 401 returns [312, 15, 3]

Source : https://stackoverflow.com/questions/7225070/php-array-delete-by-value-not-key | Last Update : Thu, 05 May 22

Answers related to php remove string from array

Code Explorer Popular Question For Php