3v4l.org

run code in 500+ 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                              ~12     [0]
         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                              ~18     [1]
         24        BIND_LEXICAL                                                 ~18, !4
   11    25        SEND_VAL                                                     ~18
    9    26        DO_ICALL                                             $19     
         27        ASSIGN                                                       !5, $19
   13    28        INIT_FCALL                                                   'var_dump'
         29        SEND_VAR                                                     !5
         30        DO_ICALL                                                     
         31      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j38AC
function name:  {closure:/in/j38AC:8}
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 Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j38AC
function name:  {closure:/in/j38AC:9}
number of ops:  7
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        FETCH_DIM_R                                          ~2      !0, 'id'
          3        FRAMELESS_ICALL_2                in_array            ~3      ~2, !1
          4        BOOL_NOT                                             ~4      ~3
          5      > RETURN                                                       ~4
   11     6*     > RETURN                                                       null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.05 ms | 2850 KiB | 17 Q