PHP 8.5.0 Released!

Voting

: max(zero, seven)?
(Example: nine)

The Note You're Voting On

Anonymous
19 years ago
array_diff provides a handy way of deleting array elements by their value, without having to unset it by key, through a lengthy foreach loop and then having to rekey the array.

<?php

//pass value you wish to delete and the array to delete from
function array_delete( $value, $array)
{
    $array = array_diff( $array, array($value) );
    return $array;
}
?>

<< Back to user notes page

To Top