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); echo "var3 = $var3"; var_dump($var3); 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
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SeHll
function name:  (null)
number of ops:  65
compiled vars:  !0 = $arr1, !1 = $var2, !2 = $var3
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                                         $5      
         11        ASSIGN                                                   !2, $5
    6    12        NOP                                                      
         13        FAST_CONCAT                                      ~7      'var3+%3D+', !2
         14        ECHO                                                     ~7
    7    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                                 
    8    18        INIT_FCALL                                               'var_dump'
         19        INIT_FCALL_BY_NAME                                       'poor_mans_strcmp'
         20        SEND_VAL_EX                                              'a'
         21        SEND_VAL_EX                                              'z'
         22        DO_FCALL                                      0  $9      
         23        SEND_VAR                                                 $9
         24        DO_ICALL                                                 
    9    25        INIT_FCALL                                               'var_dump'
         26        INIT_FCALL_BY_NAME                                       'poor_mans_strcmp'
         27        SEND_VAL_EX                                              'q111f'
         28        SEND_VAL_EX                                              'fffff'
         29        DO_FCALL                                      0  $11     
         30        SEND_VAR                                                 $11
         31        DO_ICALL                                                 
   10    32        INIT_FCALL                                               'var_dump'
         33        INIT_FCALL_BY_NAME                                       'poor_mans_strcmp'
         34        SEND_VAR_EX                                              !0
         35        SEND_VAR_EX                                              !1
         36        DO_FCALL                                      0  $13     
         37        SEND_VAR                                                 $13
         38        DO_ICALL                                                 
   11    39        INIT_FCALL                                               'var_dump'
         40        INIT_FCALL_BY_NAME                                       'poor_mans_strcmp'
         41        CHECK_FUNC_ARG                                           
         42        FETCH_DIM_FUNC_ARG                               $15     !0, 0
         43        SEND_FUNC_ARG                                            $15
         44        SEND_VAR_EX                                              !1
         45        DO_FCALL                                      0  $16     
         46        SEND_VAR                                                 $16
         47        DO_ICALL                                                 
   12    48        INIT_FCALL                                               'var_dump'
         49        INIT_FCALL_BY_NAME                                       'poor_mans_strcmp'
         50        SEND_VAR_EX                                              !1
         51        SEND_VAR_EX                                              !1
         52        DO_FCALL                                      0  $18     
         53        SEND_VAR                                                 $18
         54        DO_ICALL                                                 
   13    55        INIT_FCALL                                               'var_dump'
         56        INIT_FCALL_BY_NAME                                       'poor_mans_strcmp'
         57        CHECK_FUNC_ARG                                           
         58        FETCH_DIM_FUNC_ARG                               $20     !0, 0
         59        SEND_FUNC_ARG                                            $20
         60        SEND_VAR_EX                                              !2
         61        DO_FCALL                                      0  $21     
         62        SEND_VAR                                                 $21
         63        DO_ICALL                                                 
   24    64      > 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/SeHll
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
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        ASSIGN                                                   !2, 0
   18     3        CONCAT                                           ~6      'a', !0
          4        ASSIGN                                                   !3, ~6
   19     5        CONCAT                                           ~8      'a', !1
          6        ASSIGN                                                   !4, ~8
   20     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !3
          9        SEND_VAR                                                 !4
         10        DO_ICALL                                                 
   21    11        IS_SMALLER                                               !3, !4
         12      > JMPZ                                                     ~11, ->14
         13    >   ASSIGN                                                   !2, -1
   22    14    >   IS_SMALLER                                               !4, !3
         15      > JMPZ                                                     ~13, ->17
         16    >   ASSIGN                                                   !2, 1
   23    17    > > RETURN                                                   !2
   24    18*     > RETURN                                                   null

End of function poor_mans_strcmp

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.51 ms | 1392 KiB | 17 Q