3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function data($query) { return var_dump($this->format($this->search($this->factory(), $query))); } protected function factory() { return array( 'hello world', 'test 123', 'laravel', 'php', 'twitter', 'liquid', 'twekkisd', 'tekkit', 'minecrtafspeltwrong', 'minecraft', 'java', 'hhvm', 'qwertuop', 'qwerty', 'abc', 'coffee', 'dsmg', 'admin@dsmg.co.uk', 'graham@dsmg.co.uk' ); } protected function search($data, $query) { foreach ($data as $key => $value) { if (strpos($value, $query) === false) { unset($data[$key]); } } return $data; } protected function format($data) { $new = array(); foreach($data as $value) { $tmp = new stdClass; $tmp->val = $value; $new[] = $tmp; } return $new; } } (new Test)->data('123');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WvLPh
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   57     0  E >   NEW                                              $0      'Test'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $0, 'data'
          3        SEND_VAL_EX                                              '123'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class Test:
Function data:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WvLPh
function name:  data
number of ops:  15
compiled vars:  !0 = $query
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'var_dump'
          2        INIT_METHOD_CALL                                         'format'
          3        INIT_METHOD_CALL                                         'search'
          4        INIT_METHOD_CALL                                         'factory'
          5        DO_FCALL                                      0  $1      
          6        SEND_VAR_NO_REF_EX                                       $1
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $2      
          9        SEND_VAR_NO_REF_EX                                       $2
         10        DO_FCALL                                      0  $3      
         11        SEND_VAR                                                 $3
         12        DO_ICALL                                         $4      
         13      > RETURN                                                   $4
    8    14*     > RETURN                                                   null

End of function data

Function factory:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WvLPh
function name:  factory
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E > > RETURN                                                   <array>
   33     1*     > RETURN                                                   null

End of function factory

Function search:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 13
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/WvLPh
function name:  search
number of ops:  16
compiled vars:  !0 = $data, !1 = $query, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   37     2      > FE_RESET_R                                       $4      !0, ->13
          3    > > FE_FETCH_R                                       ~5      $4, !2, ->13
          4    >   ASSIGN                                                   !3, ~5
   38     5        INIT_FCALL                                               'strpos'
          6        SEND_VAR                                                 !2
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $7      
          9        TYPE_CHECK                                    4          $7
         10      > JMPZ                                                     ~8, ->12
   39    11    >   UNSET_DIM                                                !0, !3
   37    12    > > JMP                                                      ->3
         13    >   FE_FREE                                                  $4
   42    14      > RETURN                                                   !0
   43    15*     > RETURN                                                   null

End of function search

Function format:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/WvLPh
function name:  format
number of ops:  15
compiled vars:  !0 = $data, !1 = $new, !2 = $value, !3 = $tmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   45     0  E >   RECV                                             !0      
   47     1        ASSIGN                                                   !1, <array>
   48     2      > FE_RESET_R                                       $5      !0, ->12
          3    > > FE_FETCH_R                                               $5, !2, ->12
   49     4    >   NEW                                              $6      'stdClass'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !3, $6
   50     7        ASSIGN_OBJ                                               !3, 'val'
          8        OP_DATA                                                  !2
   51     9        ASSIGN_DIM                                               !1
         10        OP_DATA                                                  !3
   48    11      > JMP                                                      ->3
         12    >   FE_FREE                                                  $5
   53    13      > RETURN                                                   !1
   54    14*     > RETURN                                                   null

End of function format

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.26 ms | 1400 KiB | 17 Q