3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Source: https://bugs.php.net/bug.php?id=61225 $wyraz1= "babc"; $wyraz2="abba"; function testWyraz($wyraz){ $isAnagram = array(); for ($i=0;$i<strlen($wyraz);$i++) { if (isset($isAnagram[$wyraz[$i]])) $isAnagram[$wyraz[$i]]++; else $isAnagram[$wyraz[$i]] = 1; } ksort($isAnagram); return $isAnagram; } function testAnagram($wyraz,$wyraz2) { if (strlen($wyraz) === strlen($wyraz2)) { if (testWyraz($wyraz) == testWyraz($wyraz2)) { echo "identical"; } else { echo "not ident.";}} else {echo "rozne dlugosci";} } testAnagram($wyraz1,$wyraz2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p2KH3
function name:  (null)
number of ops:  7
compiled vars:  !0 = $wyraz1, !1 = $wyraz2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, 'babc'
    5     1        ASSIGN                                                   !1, 'abba'
   28     2        INIT_FCALL                                               'testanagram'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Function testwyraz:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 4
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 4
Branch analysis from position: 18
Branch analysis from position: 4
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 4
Branch analysis from position: 18
Branch analysis from position: 4
filename:       /in/p2KH3
function name:  testWyraz
number of ops:  23
compiled vars:  !0 = $wyraz, !1 = $isAnagram, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ASSIGN                                                   !1, <array>
    9     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->15
   10     4    >   FETCH_DIM_R                                      ~5      !0, !2
          5        ISSET_ISEMPTY_DIM_OBJ                         0          !1, ~5
          6      > JMPZ                                                     ~6, ->11
          7    >   FETCH_DIM_R                                      ~7      !0, !2
          8        FETCH_DIM_RW                                     $8      !1, ~7
          9        PRE_INC                                                  $8
         10      > JMP                                                      ->14
   11    11    >   FETCH_DIM_R                                      ~10     !0, !2
         12        ASSIGN_DIM                                               !1, ~10
         13        OP_DATA                                                  1
    9    14    >   PRE_INC                                                  !2
         15    >   STRLEN                                           ~13     !0
         16        IS_SMALLER                                               !2, ~13
         17      > JMPNZ                                                    ~14, ->4
   13    18    >   INIT_FCALL                                               'ksort'
         19        SEND_REF                                                 !1
         20        DO_ICALL                                                 
   14    21      > RETURN                                                   !1
   15    22*     > RETURN                                                   null

End of function testwyraz

Function testanagram:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 18
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p2KH3
function name:  testAnagram
number of ops:  20
compiled vars:  !0 = $wyraz, !1 = $wyraz2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   19     2        STRLEN                                           ~2      !0
          3        STRLEN                                           ~3      !1
          4        IS_IDENTICAL                                             ~2, ~3
          5      > JMPZ                                                     ~4, ->18
   20     6    >   INIT_FCALL                                               'testwyraz'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0  $5      
          9        INIT_FCALL                                               'testwyraz'
         10        SEND_VAR                                                 !1
         11        DO_FCALL                                      0  $6      
         12        IS_EQUAL                                                 $5, $6
         13      > JMPZ                                                     ~7, ->16
   21    14    >   ECHO                                                     'identical'
         15      > JMP                                                      ->17
   23    16    >   ECHO                                                     'not+ident.'
         17    > > JMP                                                      ->19
   25    18    >   ECHO                                                     'rozne+dlugosci'
   26    19    > > RETURN                                                   null

End of function testanagram

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.03 ms | 1394 KiB | 18 Q