3v4l.org

run code in 300+ PHP versions simultaneously
<?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));
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
NULL Fatal error: Uncaught TypeError: array_column(): Argument #1 ($array) must be of type array, null given in /in/bl744:73 Stack trace: #0 /in/bl744(73): array_column(NULL, 'sku') #1 {main} thrown in /in/bl744 on line 73
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 NULL Fatal error: Uncaught TypeError: array_column(): Argument #1 ($array) must be of type array, null given in /in/bl744:73 Stack trace: #0 /in/bl744(73): array_column(NULL, 'sku') #1 {main} thrown in /in/bl744 on line 73
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
NULL Warning: array_column() expects parameter 1 to be array, null given in /in/bl744 on line 73 Warning: array_diff(): Expected parameter 2 to be an array, null given in /in/bl744 on line 75 NULL
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33
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

preferences:
165.15 ms | 402 KiB | 200 Q