3v4l.org

run code in 300+ PHP versions simultaneously
<?php # It is NOT OK to start reading past the end of the string, no, no. Bad programmer. var_dump(substr("a", 1)); # But it is OK to ask for a bigger slice than the length of the string. var_dump(substr("a", 0, 10)); # It is also OK to read past the begining of the string, why not. var_dump(substr("a", -1)); var_dump(substr("a", -2)); # On the other hand, it is NOT OK to stop reading before the end of the string. Bad programmer. var_dump(substr("a", 0, -2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gtFjk
function name:  (null)
number of ops:  38
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'substr'
          2        SEND_VAL                                                 'a'
          3        SEND_VAL                                                 1
          4        DO_ICALL                                         $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
    7     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'substr'
          9        SEND_VAL                                                 'a'
         10        SEND_VAL                                                 0
         11        SEND_VAL                                                 10
         12        DO_ICALL                                         $2      
         13        SEND_VAR                                                 $2
         14        DO_ICALL                                                 
   10    15        INIT_FCALL                                               'var_dump'
         16        INIT_FCALL                                               'substr'
         17        SEND_VAL                                                 'a'
         18        SEND_VAL                                                 -1
         19        DO_ICALL                                         $4      
         20        SEND_VAR                                                 $4
         21        DO_ICALL                                                 
   11    22        INIT_FCALL                                               'var_dump'
         23        INIT_FCALL                                               'substr'
         24        SEND_VAL                                                 'a'
         25        SEND_VAL                                                 -2
         26        DO_ICALL                                         $6      
         27        SEND_VAR                                                 $6
         28        DO_ICALL                                                 
   14    29        INIT_FCALL                                               'var_dump'
         30        INIT_FCALL                                               'substr'
         31        SEND_VAL                                                 'a'
         32        SEND_VAL                                                 0
         33        SEND_VAL                                                 -2
         34        DO_ICALL                                         $8      
         35        SEND_VAR                                                 $8
         36        DO_ICALL                                                 
         37      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.8 ms | 1000 KiB | 15 Q