3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = new StdClass('a'); $b = new StdClass('b'); $array1 = array($a, $a, $b); $array2 = array($a, $b, $b); var_dump($a == $b); function checkWhetherSame($array1, $array2) { $clone = array_values($array2); foreach ($array1 as $val) { if(in_array($val, $clone)) { $key = array_search($val, $clone); var_dump($key); unset($clone[$key]); var_dump($clone); } else { return false; } } return count($clone) === 0; }; var_dump(checkWhetherSame($array1, $array2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EMMVU
function name:  (null)
number of ops:  28
compiled vars:  !0 = $a, !1 = $b, !2 = $array1, !3 = $array2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $4      'StdClass'
          1        SEND_VAL_EX                                              'a'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $4
    4     4        NEW                                              $7      'StdClass'
          5        SEND_VAL_EX                                              'b'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $7
    5     8        INIT_ARRAY                                       ~10     !0
          9        ADD_ARRAY_ELEMENT                                ~10     !0
         10        ADD_ARRAY_ELEMENT                                ~10     !1
         11        ASSIGN                                                   !2, ~10
    6    12        INIT_ARRAY                                       ~12     !0
         13        ADD_ARRAY_ELEMENT                                ~12     !1
         14        ADD_ARRAY_ELEMENT                                ~12     !1
         15        ASSIGN                                                   !3, ~12
    8    16        INIT_FCALL                                               'var_dump'
         17        IS_EQUAL                                         ~14     !0, !1
         18        SEND_VAL                                                 ~14
         19        DO_ICALL                                                 
   29    20        INIT_FCALL                                               'var_dump'
         21        INIT_FCALL                                               'checkwhethersame'
         22        SEND_VAR                                                 !2
         23        SEND_VAR                                                 !3
         24        DO_FCALL                                      0  $16     
         25        SEND_VAR                                                 $16
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Function checkwhethersame:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 29
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 29
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 26
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/EMMVU
function name:  checkWhetherSame
number of ops:  34
compiled vars:  !0 = $array1, !1 = $array2, !2 = $clone, !3 = $val, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2        INIT_FCALL                                               'array_values'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !2, $5
   14     6      > FE_RESET_R                                       $7      !0, ->29
          7    > > FE_FETCH_R                                               $7, !3, ->29
   15     8    >   INIT_FCALL                                               'in_array'
          9        SEND_VAR                                                 !3
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $8      
         12      > JMPZ                                                     $8, ->26
   17    13    >   INIT_FCALL                                               'array_search'
         14        SEND_VAR                                                 !3
         15        SEND_VAR                                                 !2
         16        DO_ICALL                                         $9      
         17        ASSIGN                                                   !4, $9
   18    18        INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !4
         20        DO_ICALL                                                 
   19    21        UNSET_DIM                                                !2, !4
   20    22        INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !2
         24        DO_ICALL                                                 
         25      > JMP                                                      ->28
   22    26    >   FE_FREE                                                  $7
         27      > RETURN                                                   <false>
   14    28    > > JMP                                                      ->7
         29    >   FE_FREE                                                  $7
   26    30        COUNT                                            ~13     !2
         31        IS_IDENTICAL                                     ~14     ~13, 0
         32      > RETURN                                                   ~14
   27    33*     > RETURN                                                   null

End of function checkwhethersame

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.05 ms | 1403 KiB | 22 Q