3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = json_encode(Array( Array("StartDate"=>"2014/07/31","LocZipCode"=>"19406","LocationURL"=>"FSU","EventType"=>"UN"), Array("StartDate"=>"2014/08/31","LocZipCode"=>"23513","LocationURL"=>"FSU","EventType"=>"UN"), Array("StartDate"=>"2014/07/31","LocZipCode"=>"92108","LocationURL"=>"BU","EventType"=>"UN"), Array("StartDate"=>"2014/09/30","LocZipCode"=>"78661","LocationURL"=>"BU","EventType"=>"UN") )); // even using a global variable doesn't // make it visible in getUniv() function global $univ_seg; $univ_seg = 'FSU'; getUA($data, $univ_seg); function getUniv($univ_seg){ return create_function('$a','return $a["EventType"] == "UN" && $a["LocationURL"] == ' . $univ_seg . ';'); } function getUA($data, $univ_seg) { $univ_sched = json_decode($data, true); $re = array_filter($univ_sched, getUniv($univ_seg)); print_r($re); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ub8C0
function name:  (null)
number of ops:  11
compiled vars:  !0 = $data, !1 = $univ_seg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'json_encode'
    3     1        SEND_VAL                                                 <array>
          2        DO_ICALL                                         $2      
    2     3        ASSIGN                                                   !0, $2
   11     4        BIND_GLOBAL                                              !1, 'univ_seg'
   12     5        ASSIGN                                                   !1, 'FSU'
   14     6        INIT_FCALL_BY_NAME                                       'getUA'
          7        SEND_VAR_EX                                              !0
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
   24    10      > RETURN                                                   1

Function getuniv:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ub8C0
function name:  getUniv
number of ops:  9
compiled vars:  !0 = $univ_seg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   17     1        INIT_FCALL_BY_NAME                                       'create_function'
          2        SEND_VAL_EX                                              '%24a'
          3        CONCAT                                           ~1      'return+%24a%5B%22EventType%22%5D+%3D%3D+%22UN%22+%26%26+%24a%5B%22LocationURL%22%5D+%3D%3D+', !0
          4        CONCAT                                           ~2      ~1, '%3B'
          5        SEND_VAL_EX                                              ~2
          6        DO_FCALL                                      0  $3      
          7      > RETURN                                                   $3
   18     8*     > RETURN                                                   null

End of function getuniv

Function getua:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ub8C0
function name:  getUA
number of ops:  19
compiled vars:  !0 = $data, !1 = $univ_seg, !2 = $univ_sched, !3 = $re
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   21     2        INIT_FCALL                                               'json_decode'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $4      
          6        ASSIGN                                                   !2, $4
   22     7        INIT_FCALL                                               'array_filter'
          8        SEND_VAR                                                 !2
          9        INIT_FCALL                                               'getuniv'
         10        SEND_VAR                                                 !1
         11        DO_FCALL                                      0  $6      
         12        SEND_VAR                                                 $6
         13        DO_ICALL                                         $7      
         14        ASSIGN                                                   !3, $7
   23    15        INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                                 
   24    18      > RETURN                                                   null

End of function getua

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.96 ms | 1403 KiB | 22 Q