3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array( 0 => array( 'name' => 'Joel first', 'title' => 'teacher', ), 1 => array( 'name' => 'Joel second', 'title' => 'teacher', ), 2 => array( 'name' => 'Jhon first', 'title' => 'teacher', ) ); $newArr = array_filter($arr, function($val){ return substr($val['name'], 0, 4) == 'Joel' && $val['title'] == 'teacher'; }); var_dump($newArr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/25Poe
function name:  (null)
number of ops:  11
compiled vars:  !0 = $arr, !1 = $newArr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   17     1        INIT_FCALL                                               'array_filter'
          2        SEND_VAR                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F25Poe%3A17%240'
   19     4        SEND_VAL                                                 ~3
          5        DO_ICALL                                         $4      
   17     6        ASSIGN                                                   !1, $4
   20     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F25Poe%3A17%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/25Poe
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        INIT_FCALL                                               'substr'
          2        FETCH_DIM_R                                      ~1      !0, 'name'
          3        SEND_VAL                                                 ~1
          4        SEND_VAL                                                 0
          5        SEND_VAL                                                 4
          6        DO_ICALL                                         $2      
          7        IS_EQUAL                                         ~3      $2, 'Joel'
          8      > JMPZ_EX                                          ~3      ~3, ->12
          9    >   FETCH_DIM_R                                      ~4      !0, 'title'
         10        IS_EQUAL                                         ~5      ~4, 'teacher'
         11        BOOL                                             ~3      ~5
         12    > > RETURN                                                   ~3
   19    13*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F25Poe%3A17%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.9 ms | 1401 KiB | 19 Q