PHP function of the day: array_diff()

For day 11 of 21 in the “PHP Function of the day” series, I’m going to look at array_diff(). It gets the difference between an array and one or more other arrays. Let’s take a look. <?php $person1 = array(“fname”=>”Joe”,”lname”=>”Smith”); $person2 = array(“fname”=>”Jane”,”lname”=>”Smith”); $differences = array_diff($person1, $person2); print_r($differences); $person3 = array(“fname”=>”Stan”,”lname”=>”Smith”); $differences = array_diff($person1, $person2, $person3); print_r($differences); …

Continue reading "PHP function of the day: array_diff()"