3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $allowed = array('outbound_status_id', 'billing_status_id', 'date_released'); print_r(array_flip($allowed)); $cleanValues = array('gross'=>1, 'tare'=>2, 'outbound_status_id'=>3, 'driver_name'=>'bob', 'quantity'=>'awesome'); print_r(array_intersect($cleanValues, array_flip($allowed))); print_r(array_intersect_assoc($cleanValues, array_flip($allowed))); print_r(array_diff($cleanValues, array_flip($allowed))); print_r(array_diff_assoc($cleanValues, array_flip($allowed)));
based on ItZr0
Output for 4.3.0 - 7.1.0
Array ( [outbound_status_id] => 0 [billing_status_id] => 1 [date_released] => 2 ) Array ( [gross] => 1 [tare] => 2 ) Array ( ) Array ( [outbound_status_id] => 3 [driver_name] => bob [quantity] => awesome ) Array ( [gross] => 1 [tare] => 2 [outbound_status_id] => 3 [driver_name] => bob [quantity] => awesome )