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['data']['items']); $new = array_filter($array1['data'], function($var) use ($ids) { return !in_array($var['id'], $ids); }); var_dump($new);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j38AC
function name:  (null)
number of ops:  32
compiled vars:  !0 = $json1, !1 = $json2, !2 = $array1, !3 = $array2, !4 = $ids, !5 = $new
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%7B%22data%22%3A+%5B%7B%22category%22%3A+%22Games%22%2C%22id%22%3A+%2245345%22%7D%2C+%7B%22category%22%3A+%22Music%22%2C%22id%22%3A+%22345345345%22%7D%2C+%7B%22category%22%3A+%22Food%22%2C%22id%22%3A+%221%22%7D%2C+%7B%22category%22%3A+%22Pets%22%2C%22id%22%3A+%2213245345%22%7D%5D%2C%22paging%22%3A+%7B%22next%22%3A+%22https%3A%2F%2Fgraph.facebook.com%2F1161990140%2Flikes%3Flimit%3D2%26offset%3D2%26__after_id%3D118243704898877%22%7D%7D'
    3     1        ASSIGN                                                   !1, '%7B%22data%22%3A++%7B%22something%22%3A+%22blah%22%2C%22posts%22%3A++%5B%7B%22id%22%3A+%2234241%22%2C%22title%22%3A+%22orange%22%7D%5D%2C%22items%22%3A++%5B%7B%22id%22%3A+%221%22%2C%22name%22%3A+%22orange%22%7D%2C%7B%22id%22%3A+%222%22%2C%22name%22%3A+%22dog%22%7D%2C%7B%22id%22%3A+%223%22%2C%22name%22%3A+%22cat%22%7D%2C%7B%22id%22%3A+%224%22%2C%22name%22%3A+%22apple%22%7D%5D%7D%7D'
    5     2        INIT_FCALL                                               'json_decode'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $8      
          6        ASSIGN                                                   !2, $8
    6     7        INIT_FCALL                                               'json_decode'
          8        SEND_VAR                                                 !1
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $10     
         11        ASSIGN                                                   !3, $10
    8    12        INIT_FCALL                                               'array_map'
         13        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fj38AC%3A8%240'
         14        SEND_VAL                                                 ~12
         15        FETCH_DIM_R                                      ~13     !3, 'data'
         16        FETCH_DIM_R                                      ~14     ~13, 'items'
         17        SEND_VAL                                                 ~14
         18        DO_ICALL                                         $15     
         19        ASSIGN                                                   !4, $15
    9    20        INIT_FCALL                                               'array_filter'
         21        FETCH_DIM_R                                      ~17     !2, 'data'
         22        SEND_VAL                                                 ~17
         23        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fj38AC%3A9%241'
         24        BIND_LEXICAL                                             ~18, !4
   11    25        SEND_VAL                                                 ~18
         26        DO_ICALL                                         $19     
    9    27        ASSIGN                                                   !5, $19
   13    28        INIT_FCALL                                               'var_dump'
         29        SEND_VAR                                                 !5
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fj38AC%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j38AC
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        FETCH_DIM_R                                      ~1      !0, 'id'
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fj38AC%3A8%240

Function %00%7Bclosure%7D%2Fin%2Fj38AC%3A9%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j38AC
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $var, !1 = $ids
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   10     2        INIT_FCALL                                               'in_array'
          3        FETCH_DIM_R                                      ~2      !0, 'id'
          4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $3      
          7        BOOL_NOT                                         ~4      $3
          8      > RETURN                                                   ~4
   11     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fj38AC%3A9%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.42 ms | 1400 KiB | 23 Q