3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr1 []= 'wello'; $var2 = 'woodbye wruel world'; var_dump(poor_mans_strcmp($var1, $var2)); var_dump(poor_mans_strcmp($var2, $var2)); function poor_mans_strcmp($str1, $str2) { $result = 0; $str3 = 'a' . $str1; $str4 = 'a' . $str2; 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/Ljigh
function name:  (null)
number of ops:  18
compiled vars:  !0 = $arr1, !1 = $var2, !2 = $var1
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'
    6     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL_BY_NAME                                       'poor_mans_strcmp'
          5        SEND_VAR_EX                                              !2
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0  $5      
          8        SEND_VAR                                                 $5
          9        DO_ICALL                                                 
    7    10        INIT_FCALL                                               'var_dump'
         11        INIT_FCALL_BY_NAME                                       'poor_mans_strcmp'
         12        SEND_VAR_EX                                              !1
         13        SEND_VAR_EX                                              !1
         14        DO_FCALL                                      0  $7      
         15        SEND_VAR                                                 $7
         16        DO_ICALL                                                 
   17    17      > RETURN                                                   1

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

End of function poor_mans_strcmp

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.46 ms | 1388 KiB | 15 Q