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); function checkWhetherSame($array1, $array2) { $clone = array_values($array2); foreach ($array1 as $val) { if(in_array($val, $clone)) { $key = array_search($val, $clone); 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/O5Dul
function name:  (null)
number of ops:  22
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        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
    4     3        NEW                                              $7      'StdClass'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $7
    5     6        INIT_ARRAY                                       ~10     !0
          7        ADD_ARRAY_ELEMENT                                ~10     !0
          8        ADD_ARRAY_ELEMENT                                ~10     !1
          9        ASSIGN                                                   !2, ~10
    6    10        INIT_ARRAY                                       ~12     !0
         11        ADD_ARRAY_ELEMENT                                ~12     !1
         12        ADD_ARRAY_ELEMENT                                ~12     !1
         13        ASSIGN                                                   !3, ~12
   25    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'checkwhethersame'
         16        SEND_VAR                                                 !2
         17        SEND_VAR                                                 !3
         18        DO_FCALL                                      0  $14     
         19        SEND_VAR                                                 $14
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

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

End of function checkwhethersame

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.53 ms | 1402 KiB | 22 Q