3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = new StdClass(); $b = new StdClass(); $array1 = array($a, $a, $b); $array2 = array($a, $b, $b); $clone = clone($array1); function checkWhetherSame($array1, $array2) { foreach ($array1 as $val) { if(in_array($val, $clone)) { $key = array_search($val, $clone); unset($clone[$key]); } 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/gRLGL
function name:  (null)
number of ops:  24
compiled vars:  !0 = $a, !1 = $b, !2 = $array1, !3 = $array2, !4 = $clone
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   NEW                                              $5      'StdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $5
    4     3        NEW                                              $8      'StdClass'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $8
    5     6        INIT_ARRAY                                       ~11     !0
          7        ADD_ARRAY_ELEMENT                                ~11     !0
          8        ADD_ARRAY_ELEMENT                                ~11     !1
          9        ASSIGN                                                   !2, ~11
    6    10        INIT_ARRAY                                       ~13     !0
         11        ADD_ARRAY_ELEMENT                                ~13     !1
         12        ADD_ARRAY_ELEMENT                                ~13     !1
         13        ASSIGN                                                   !3, ~13
    8    14        CLONE                                            ~15     !2
         15        ASSIGN                                                   !4, ~15
   23    16        INIT_FCALL                                               'var_dump'
         17        INIT_FCALL                                               'checkwhethersame'
         18        SEND_VAR                                                 !2
         19        SEND_VAR                                                 !3
         20        DO_FCALL                                      0  $17     
         21        SEND_VAR                                                 $17
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

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

End of function checkwhethersame

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.95 ms | 1403 KiB | 20 Q