3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = array( "foo" => "bar", "biz" => "baz" ); function normalizeCapitalization($assert, $lowercaseParameter) { if (isset($assert[$lowercaseParameter])){ $uppercaseParameter = ucfirst($lowercaseParameter); $assert[$uppercaseParameter] = $assert[$lowercaseParameter]; unset($assert[$lowercaseParameter]); } return $assert; } $test = normalizeCapitalization($test, "foo"); $test = normalizeCapitalization($test, "bar"); print_r($test);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jKtsh
function name:  (null)
number of ops:  15
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   17     1        INIT_FCALL                                               'normalizecapitalization'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'foo'
          4        DO_FCALL                                      0  $2      
          5        ASSIGN                                                   !0, $2
   18     6        INIT_FCALL                                               'normalizecapitalization'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 'bar'
          9        DO_FCALL                                      0  $4      
         10        ASSIGN                                                   !0, $4
   19    11        INIT_FCALL                                               'print_r'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function normalizecapitalization:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/jKtsh
function name:  normalizeCapitalization
number of ops:  14
compiled vars:  !0 = $assert, !1 = $lowercaseParameter, !2 = $uppercaseParameter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        ISSET_ISEMPTY_DIM_OBJ                         0          !0, !1
          3      > JMPZ                                                     ~3, ->12
   10     4    >   INIT_FCALL                                               'ucfirst'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !2, $4
   11     8        FETCH_DIM_R                                      ~7      !0, !1
          9        ASSIGN_DIM                                               !0, !2
         10        OP_DATA                                                  ~7
   12    11        UNSET_DIM                                                !0, !1
   14    12    > > RETURN                                                   !0
   15    13*     > RETURN                                                   null

End of function normalizecapitalization

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.27 ms | 1399 KiB | 19 Q