3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = 'string'; echo $string[-1] . PHP_EOL; echo substr($string, -1, 1) . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/m44Or
function name:  (null)
number of ops:  12
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'string'
    4     1        FETCH_DIM_R                                      ~2      !0, -1
          2        CONCAT                                           ~3      ~2, '%0A'
          3        ECHO                                                     ~3
    5     4        INIT_FCALL                                               'substr'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 -1
          7        SEND_VAL                                                 1
          8        DO_ICALL                                         $4      
          9        CONCAT                                           ~5      $4, '%0A'
         10        ECHO                                                     ~5
    6    11      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.31 ms | 1003 KiB | 14 Q