3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json1 = '{"data": [{"category": "Games","id": "45345"}, {"category": "Music","id": "345345345"}, {"category": "Food","id": "1"}, {"category": "Pets","id": "13245345"}],"paging": {"next": "https://graph.facebook.com/1161990140/likes?limit=2&offset=2&__after_id=118243704898877"}}'; $json2 = '{"data": {"something": "blah","posts": [{"id": "34241","title": "orange"}],"items": [{"id": "1","name": "orange"},{"id": "2","name": "dog"},{"id": "3","name": "cat"},{"id": "4","name": "apple"}]}}'; $array1 = json_decode($json1, true); $array2 = json_decode($json2, true); $ids = array_map(function($value) { return $value['id']; }, $array2['items']); $new = array_filter($array1['data'], function($var) use ($ids) { return !in_array($var['id'], $ids); }); var_dump($new);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined array key "items" in /in/YvSv5 on line 8 Fatal error: Uncaught TypeError: array_map(): Argument #2 ($array) must be of type array, null given in /in/YvSv5:8 Stack trace: #0 /in/YvSv5(8): array_map(Object(Closure), NULL) #1 {main} thrown in /in/YvSv5 on line 8
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
38.26 ms | 401 KiB | 8 Q