Deletes every element of given array for which the given callback function evaluates to false.

array:keep_value_if(ARRAY $array, FUNCTION $callback) : ARRAY

array:keep_value_if(["User",2,"Name"],type:string?)
#=> [ 0 => "User", 2 => "Name" ]

array:keep_value_if([1,2,3,4], function($number){ return $number > 2; })
#=> [ 2 => 3, 3 => 4 ]

array:keep_value_if([],type:string?)
#=> []

Copyright ©2013-2022 SunSed®. All rights reserved.