3v4l.org

run code in 300+ PHP versions simultaneously
<?php function sub_string($string, $start, $length) { $result = substr($string,$start,$length); return $result; } $test_string = '1978-02-16'; $year = sub_string($test_string,0,4); echo $year."\r\n"; $month = sub_string($test_string,5,2); echo $month."\r\n"; $day = sub_string($test_string,8,2); echo $day."\r\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kXklg
function name:  (null)
number of ops:  26
compiled vars:  !0 = $test_string, !1 = $year, !2 = $month, !3 = $day
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                   !0, '1978-02-16'
    7     1        INIT_FCALL                                               'sub_string'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 0
          4        SEND_VAL                                                 4
          5        DO_FCALL                                      0  $5      
          6        ASSIGN                                                   !1, $5
    8     7        CONCAT                                           ~7      !1, '%0D%0A'
          8        ECHO                                                     ~7
    9     9        INIT_FCALL                                               'sub_string'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 5
         12        SEND_VAL                                                 2
         13        DO_FCALL                                      0  $8      
         14        ASSIGN                                                   !2, $8
   10    15        CONCAT                                           ~10     !2, '%0D%0A'
         16        ECHO                                                     ~10
   11    17        INIT_FCALL                                               'sub_string'
         18        SEND_VAR                                                 !0
         19        SEND_VAL                                                 8
         20        SEND_VAL                                                 2
         21        DO_FCALL                                      0  $11     
         22        ASSIGN                                                   !3, $11
   12    23        CONCAT                                           ~13     !3, '%0D%0A'
         24        ECHO                                                     ~13
         25      > RETURN                                                   1

Function sub_string:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kXklg
function name:  sub_string
number of ops:  11
compiled vars:  !0 = $string, !1 = $start, !2 = $length, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    3     3        INIT_FCALL                                               'substr'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $4      
          8        ASSIGN                                                   !3, $4
    4     9      > RETURN                                                   !3
    5    10*     > RETURN                                                   null

End of function sub_string

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.05 ms | 1399 KiB | 18 Q