3v4l.org

run code in 300+ PHP versions simultaneously
<?php $path = '/test/path/controller'; $lastslash = strrpos($path, '/'); $upper_path = substr($path, 0, $lastslash) . strtoupper(substr($path, $lastslash, 1)) . strtolower(substr($path, $lastslash + 1)); echo $upper_path;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aMsL5
function name:  (null)
number of ops:  32
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        SEND_VAR                                                 !1
         10        DO_ICALL                                         $6      
         11        INIT_FCALL                                               'strtoupper'
         12        INIT_FCALL                                               'substr'
         13        SEND_VAR                                                 !0
         14        SEND_VAR                                                 !1
         15        SEND_VAL                                                 1
         16        DO_ICALL                                         $7      
         17        SEND_VAR                                                 $7
         18        DO_ICALL                                         $8      
         19        CONCAT                                           ~9      $6, $8
         20        INIT_FCALL                                               'strtolower'
         21        INIT_FCALL                                               'substr'
         22        SEND_VAR                                                 !0
         23        ADD                                              ~10     !1, 1
         24        SEND_VAL                                                 ~10
         25        DO_ICALL                                         $11     
         26        SEND_VAR                                                 $11
         27        DO_ICALL                                         $12     
         28        CONCAT                                           ~13     ~9, $12
         29        ASSIGN                                                   !2, ~13
    6    30        ECHO                                                     !2
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.07 ms | 1395 KiB | 21 Q