3v4l.org

run code in 300+ PHP versions simultaneously
<?php $path = '/test/path/controller'; $lastslash = strrpos($path, '/'); $upper_path = substr($path, 0, $lastslash+1) . strtoupper(substr($path, $lastslash+1, 1)) . strtolower(substr($path, $lastslash + 2)); echo $upper_path;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gXenJ
function name:  (null)
number of ops:  34
compiled vars:  !0 = $path, !1 = $lastslash, !2 = $upper_path
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%2Ftest%2Fpath%2Fcontroller'
    3     1        INIT_FCALL                                               'strrpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%2F'
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
    5     6        INIT_FCALL                                               'substr'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 0
          9        ADD                                              ~6      !1, 1
         10        SEND_VAL                                                 ~6
         11        DO_ICALL                                         $7      
         12        INIT_FCALL                                               'strtoupper'
         13        INIT_FCALL                                               'substr'
         14        SEND_VAR                                                 !0
         15        ADD                                              ~8      !1, 1
         16        SEND_VAL                                                 ~8
         17        SEND_VAL                                                 1
         18        DO_ICALL                                         $9      
         19        SEND_VAR                                                 $9
         20        DO_ICALL                                         $10     
         21        CONCAT                                           ~11     $7, $10
         22        INIT_FCALL                                               'strtolower'
         23        INIT_FCALL                                               'substr'
         24        SEND_VAR                                                 !0
         25        ADD                                              ~12     !1, 2
         26        SEND_VAL                                                 ~12
         27        DO_ICALL                                         $13     
         28        SEND_VAR                                                 $13
         29        DO_ICALL                                         $14     
         30        CONCAT                                           ~15     ~11, $14
         31        ASSIGN                                                   !2, ~15
    6    32        ECHO                                                     !2
         33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.62 ms | 1396 KiB | 21 Q