3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.01 ms | 1394 KiB | 15 Q