3v4l.org

run code in 300+ PHP versions simultaneously
<?php // palindrom function anagram($s1, $s2) { $l1 = strlen($s1); $l2 = strlen($s2); if($l1 != $l2) return false; // $w1 = array(); $w2 = array(); // for($a=0; $a<$l1; $a++) { if(array_key_exists($s1[$a], $w1)) { $w1[$s1[$a]] = $w1[$s1[$a]] + 1; // print_r($s1[$a]); } else { $w1[$s1[$a]] = 1; } } // print_r($w1); for($a=0; $a<$l2; $a++) { if(array_key_exists($s2[$a], $w2)) { $w2[$s2[$a]] = $w2[$s2[$a]] + 1; print_r($s2[$a]); } else { $w2[$s2[$a]] = 1; } } ksort($w1); ksort($w2); print_r($w1); print_r($w2); print_r(array_diff(array_keys($w1), array_keys($w2))); } echo anagram('test', 'test'); //print_r(array('tesfsdf' => 'dasdsad')); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DHkjt
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   INIT_FCALL                                               'anagram'
          1        SEND_VAL                                                 'test'
          2        SEND_VAL                                                 'test'
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
   46     5      > RETURN                                                   1

Function anagram:
Finding entry points
Branch analysis from position: 0
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 = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 13
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 31
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 45
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 31
Branch analysis from position: 51
Branch analysis from position: 31
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 31
Branch analysis from position: 51
Branch analysis from position: 31
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 23
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 13
Branch analysis from position: 29
Branch analysis from position: 13
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 13
Branch analysis from position: 29
Branch analysis from position: 13
filename:       /in/DHkjt
function name:  anagram
number of ops:  77
compiled vars:  !0 = $s1, !1 = $s2, !2 = $l1, !3 = $l2, !4 = $w1, !5 = $w2, !6 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        STRLEN                                           ~7      !0
          3        ASSIGN                                                   !2, ~7
    5     4        STRLEN                                           ~9      !1
          5        ASSIGN                                                   !3, ~9
    7     6        IS_NOT_EQUAL                                             !2, !3
          7      > JMPZ                                                     ~11, ->9
    8     8    > > RETURN                                                   <false>
   10     9    >   ASSIGN                                                   !4, <array>
   11    10        ASSIGN                                                   !5, <array>
   13    11        ASSIGN                                                   !6, 0
         12      > JMP                                                      ->27
   14    13    >   FETCH_DIM_R                                      ~15     !0, !6
         14        ARRAY_KEY_EXISTS                                         ~15, !4
         15      > JMPZ                                                     ~16, ->23
   15    16    >   FETCH_DIM_R                                      ~17     !0, !6
         17        FETCH_DIM_R                                      ~19     !0, !6
         18        FETCH_DIM_R                                      ~20     !4, ~19
         19        ADD                                              ~21     ~20, 1
         20        ASSIGN_DIM                                               !4, ~17
         21        OP_DATA                                                  ~21
         22      > JMP                                                      ->26
   19    23    >   FETCH_DIM_R                                      ~22     !0, !6
         24        ASSIGN_DIM                                               !4, ~22
         25        OP_DATA                                                  1
   13    26    >   PRE_INC                                                  !6
         27    >   IS_SMALLER                                               !6, !2
         28      > JMPNZ                                                    ~25, ->13
   24    29    >   ASSIGN                                                   !6, 0
         30      > JMP                                                      ->49
   25    31    >   FETCH_DIM_R                                      ~27     !1, !6
         32        ARRAY_KEY_EXISTS                                         ~27, !5
         33      > JMPZ                                                     ~28, ->45
   26    34    >   FETCH_DIM_R                                      ~29     !1, !6
         35        FETCH_DIM_R                                      ~31     !1, !6
         36        FETCH_DIM_R                                      ~32     !5, ~31
         37        ADD                                              ~33     ~32, 1
         38        ASSIGN_DIM                                               !5, ~29
         39        OP_DATA                                                  ~33
   27    40        INIT_FCALL                                               'print_r'
         41        FETCH_DIM_R                                      ~34     !1, !6
         42        SEND_VAL                                                 ~34
         43        DO_ICALL                                                 
         44      > JMP                                                      ->48
   30    45    >   FETCH_DIM_R                                      ~36     !1, !6
         46        ASSIGN_DIM                                               !5, ~36
         47        OP_DATA                                                  1
   24    48    >   PRE_INC                                                  !6
         49    >   IS_SMALLER                                               !6, !3
         50      > JMPNZ                                                    ~39, ->31
   35    51    >   INIT_FCALL                                               'ksort'
         52        SEND_REF                                                 !4
         53        DO_ICALL                                                 
   36    54        INIT_FCALL                                               'ksort'
         55        SEND_REF                                                 !5
         56        DO_ICALL                                                 
   38    57        INIT_FCALL                                               'print_r'
         58        SEND_VAR                                                 !4
         59        DO_ICALL                                                 
   39    60        INIT_FCALL                                               'print_r'
         61        SEND_VAR                                                 !5
         62        DO_ICALL                                                 
   41    63        INIT_FCALL                                               'print_r'
         64        INIT_FCALL                                               'array_diff'
         65        INIT_FCALL                                               'array_keys'
         66        SEND_VAR                                                 !4
         67        DO_ICALL                                         $44     
         68        SEND_VAR                                                 $44
         69        INIT_FCALL                                               'array_keys'
         70        SEND_VAR                                                 !5
         71        DO_ICALL                                         $45     
         72        SEND_VAR                                                 $45
         73        DO_ICALL                                         $46     
         74        SEND_VAR                                                 $46
         75        DO_ICALL                                                 
   42    76      > RETURN                                                   null

End of function anagram

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
260.32 ms | 1407 KiB | 23 Q