3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $externalProducts = json_decode('{ "Filter": { "Title": "All Products" }, "Products": [{ "Type": "Jacket", "Price": 75, "ExpiryDate": "2018-06-30", "StockNumber": "180220/003", "Created": "2018-02-20 12:24:06", "Modified": "2018-05-30 02:00:23" }, { "Type": "Jeans", "Price": 150, "ExpiryDate": "2018-06-30", "StockNumber": "180221/004", "Created": "2017-08-10 15:11:44", "Modified": "2018-05-30 02:00:22" }, { "Type": "Jacket", "Price": 240, "ExpiryDate": "2018-06-30", "StockNumber": "150804/012", "Created": "2015-08-04 17:03:42", "Modified": "2018-05-30 02:00:22" } ] }',true); $internalProducts = json_decode('"localProducts": [{ "title": "Fur Coat", "id": 16526, "created_at": "2018-05-17T10:15:45Z", "updated_at": "2018-05-17T10:15:45Z", "sku": "180514/001", "price": "75.00", "regular_price": "75.00", "categories": [ "Jackets", ], }, { "title": "Ripped Jeans", "id": 16527, "created_at": "2018-05-17T10:15:45Z", "updated_at": "2018-05-17T10:15:45Z", "sku": "180221/004", "price": "150.00", "regular_price": "150.00", "categories": [ "Jeans", ], }, { "title": "Leather Jacket", "id": 16528, "created_at": "2018-05-17T10:15:45Z", "updated_at": "2018-05-17T10:15:45Z", "sku": "150804/012", "price": "240.00", "regular_price": "240.00", "categories": [ "Jackets", ], } ]',true); var_dump($internalProducts); $extstock = array_column($externalProducts, "StockNumber"); $intsku = array_column($internalProducts, "sku"); var_dump(array_diff($extstock, $intsku));
based on 513Ev
Output for 5.6.30, 7.0.30 - 7.3.0alpha1
NULL Warning: array_column() expects parameter 1 to be array, null given in /in/bl744 on line 73 Warning: array_diff(): Argument #2 is not an array in /in/bl744 on line 75 NULL
Output for hhvm-3.22.0
NULL Warning: Invalid operand type was used: array_column expects array(s) or collection(s) in /in/bl744 on line -1 Warning: array_diff() expects parameter 2 to be an array or collection in /in/bl744 on line -1 NULL
Output for hhvm-3.21.3
NULL Warning: Invalid operand type was used: array_column expects array(s) or collection(s) in /in/bl744 on line 73 Warning: array_diff() expects parameter 2 to be an array or collection in /in/bl744 on line 75 NULL
Output for hhvm-3.18.5
NULL Warning: Invalid operand type was used: expects array(s) or collection(s) in /in/bl744 on line 73 Warning: array_diff() expects parameter 2 to be an array or collection in /in/bl744 on line 75 NULL