3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( array( "contact_name" => "contact1", "email" => "", "id" => 1 ), array( "contact_name" => "contact2", "email" => null, "id" => 2 ), array( "contact_name" => "contact3", "email" => "user@domain.com", "id" => 3 ), ); $filtered = array_filter($array, function($contact) { if(!empty($contact['email']) && $contact['email'] != '') { return $contact; } }); echo '<pre><code>', print_r($filtered), '</code></pre>';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tKtE0
function name:  (null)
number of ops:  14
compiled vars:  !0 = $array, !1 = $filtered
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   21     1        INIT_FCALL                                               'array_filter'
          2        SEND_VAR                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FtKtE0%3A21%240'
   25     4        SEND_VAL                                                 ~3
          5        DO_ICALL                                         $4      
   21     6        ASSIGN                                                   !1, $4
   27     7        ECHO                                                     '%3Cpre%3E%3Ccode%3E'
          8        INIT_FCALL                                               'print_r'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $6      
         11        ECHO                                                     $6
         12        ECHO                                                     '%3C%2Fcode%3E%3C%2Fpre%3E'
         13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FtKtE0%3A21%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/tKtE0
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $contact
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1        ISSET_ISEMPTY_DIM_OBJ                         1  ~1      !0, 'email'
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ_EX                                          ~2      ~2, ->7
          4    >   FETCH_DIM_R                                      ~3      !0, 'email'
          5        IS_NOT_EQUAL                                     ~4      ~3, ''
          6        BOOL                                             ~2      ~4
          7    > > JMPZ                                                     ~2, ->9
   23     8    > > RETURN                                                   !0
   25     9    > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FtKtE0%3A21%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.47 ms | 1396 KiB | 17 Q