3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 []= 'wello'; $var2 = 'woodbye wruel world'; $var3 = pack("n*", 0x77, 0x32 + 0x33, 0x6c, 0x6e-2, 0x6f); $var4 = pack('n*', 0x7765, 0x6c6c, 0x6f); echo "var3 = $var3"; var_dump($var4); if ($var3 == $arr1[0]) {echo "$var3 == $arr1[0]"; } var_dump(poor_mans_strcmp('a', 'z')); var_dump(poor_mans_strcmp('q111f', 'fffff')); var_dump(poor_mans_strcmp($arr1, $var2)); var_dump(poor_mans_strcmp($arr1[0], $var2)); var_dump(poor_mans_strcmp($var2, $var2)); var_dump(poor_mans_strcmp($arr1[0], $var3)); function poor_mans_strcmp($str1, $str2) { $result = 0; $str3 = 'a' . $str1; $str4 = 'a' . $str2; var_dump($str3, $str4); if ($str3 < $str4) { $result = -1; } if ($str3 > $str4) { $result = 1; } return $result; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 33
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/7K3XO
function name:  (null)
number of ops:  80
compiled vars:  !0 = $arr1, !1 = $var2, !2 = $var3, !3 = $var4
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN_DIM                                               !0
          1        OP_DATA                                                  'wello'
    4     2        ASSIGN                                                   !1, 'woodbye+wruel+world'
    5     3        INIT_FCALL                                               'pack'
          4        SEND_VAL                                                 'n%2A'
          5        SEND_VAL                                                 119
          6        SEND_VAL                                                 101
          7        SEND_VAL                                                 108
          8        SEND_VAL                                                 108
          9        SEND_VAL                                                 111
         10        DO_ICALL                                         $6      
         11        ASSIGN                                                   !2, $6
    6    12        INIT_FCALL                                               'pack'
         13        SEND_VAL                                                 'n%2A'
         14        SEND_VAL                                                 30565
         15        SEND_VAL                                                 27756
         16        SEND_VAL                                                 111
         17        DO_ICALL                                         $8      
         18        ASSIGN                                                   !3, $8
    7    19        NOP                                                      
         20        FAST_CONCAT                                      ~10     'var3+%3D+', !2
         21        ECHO                                                     ~10
    8    22        INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !3
         24        DO_ICALL                                                 
    9    25        FETCH_DIM_R                                      ~12     !0, 0
         26        IS_EQUAL                                                 !2, ~12
         27      > JMPZ                                                     ~13, ->33
         28    >   ROPE_INIT                                     3  ~16     !2
         29        ROPE_ADD                                      1  ~16     ~16, '+%3D%3D+'
         30        FETCH_DIM_R                                      ~14     !0, 0
         31        ROPE_END                                      2  ~15     ~16, ~14
         32        ECHO                                                     ~15
   10    33    >   INIT_FCALL                                               'var_dump'
         34        INIT_FCALL_BY_NAME                                       'poor_mans_strcmp'
         35        SEND_VAL_EX                                              'a'
         36        SEND_VAL_EX                                              'z'
         37        DO_FCALL                                      0  $18     
         38        SEND_VAR                                                 $18
         39        DO_ICALL                                                 
   11    40        INIT_FCALL                                               'var_dump'
         41        INIT_FCALL_BY_NAME                                       'poor_mans_strcmp'
         42        SEND_VAL_EX                                              'q111f'
         43        SEND_VAL_EX                                              'fffff'
         44        DO_FCALL                                      0  $20     
         45        SEND_VAR                                                 $20
         46        DO_ICALL                                                 
   12    47        INIT_FCALL                                               'var_dump'
         48        INIT_FCALL_BY_NAME                                       'poor_mans_strcmp'
         49        SEND_VAR_EX                                              !0
         50        SEND_VAR_EX                                              !1
         51        DO_FCALL                                      0  $22     
         52        SEND_VAR                                                 $22
         53        DO_ICALL                                                 
   13    54        INIT_FCALL                                               'var_dump'
         55        INIT_FCALL_BY_NAME                                       'poor_mans_strcmp'
         56        CHECK_FUNC_ARG                                           
         57        FETCH_DIM_FUNC_ARG                               $24     !0, 0
         58        SEND_FUNC_ARG                                            $24
         59        SEND_VAR_EX                                              !1
         60        DO_FCALL                                      0  $25     
         61        SEND_VAR                                                 $25
         62        DO_ICALL                                                 
   14    63        INIT_FCALL                                               'var_dump'
         64        INIT_FCALL_BY_NAME                                       'poor_mans_strcmp'
         65        SEND_VAR_EX                                              !1
         66        SEND_VAR_EX                                              !1
         67        DO_FCALL                                      0  $27     
         68        SEND_VAR                                                 $27
         69        DO_ICALL                                                 
   15    70        INIT_FCALL                                               'var_dump'
         71        INIT_FCALL_BY_NAME                                       'poor_mans_strcmp'
         72        CHECK_FUNC_ARG                                           
         73        FETCH_DIM_FUNC_ARG                               $29     !0, 0
         74        SEND_FUNC_ARG                                            $29
         75        SEND_VAR_EX                                              !2
         76        DO_FCALL                                      0  $30     
         77        SEND_VAR                                                 $30
         78        DO_ICALL                                                 
   26    79      > RETURN                                                   1

Function poor_mans_strcmp:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 14
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 17
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
Branch analysis from position: 14
filename:       /in/7K3XO
function name:  poor_mans_strcmp
number of ops:  19
compiled vars:  !0 = $str1, !1 = $str2, !2 = $result, !3 = $str3, !4 = $str4
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   19     2        ASSIGN                                                   !2, 0
   20     3        CONCAT                                           ~6      'a', !0
          4        ASSIGN                                                   !3, ~6
   21     5        CONCAT                                           ~8      'a', !1
          6        ASSIGN                                                   !4, ~8
   22     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !3
          9        SEND_VAR                                                 !4
         10        DO_ICALL                                                 
   23    11        IS_SMALLER                                               !3, !4
         12      > JMPZ                                                     ~11, ->14
         13    >   ASSIGN                                                   !2, -1
   24    14    >   IS_SMALLER                                               !4, !3
         15      > JMPZ                                                     ~13, ->17
         16    >   ASSIGN                                                   !2, 1
   25    17    > > RETURN                                                   !2
   26    18*     > RETURN                                                   null

End of function poor_mans_strcmp

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.57 ms | 1404 KiB | 17 Q