3v4l.org

run code in 500+ 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:  23
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                                   'var_dump'
          1        FRAMELESS_ICALL_2                substr              ~0      'a', 1
          2        SEND_VAL                                                     ~0
          3        DO_ICALL                                                     
    7     4        INIT_FCALL                                                   'var_dump'
          5        FRAMELESS_ICALL_3                substr              ~2      'a', 0
          6        OP_DATA                                                      10
          7        SEND_VAL                                                     ~2
          8        DO_ICALL                                                     
   10     9        INIT_FCALL                                                   'var_dump'
         10        FRAMELESS_ICALL_2                substr              ~4      'a', -1
         11        SEND_VAL                                                     ~4
         12        DO_ICALL                                                     
   11    13        INIT_FCALL                                                   'var_dump'
         14        FRAMELESS_ICALL_2                substr              ~6      'a', -2
         15        SEND_VAL                                                     ~6
         16        DO_ICALL                                                     
   14    17        INIT_FCALL                                                   'var_dump'
         18        FRAMELESS_ICALL_3                substr              ~8      'a', 0
         19        OP_DATA                                                      -2
         20        SEND_VAL                                                     ~8
         21        DO_ICALL                                                     
         22      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
240.22 ms | 2641 KiB | 14 Q