3v4l.org

run code in 300+ PHP versions simultaneously
<html> <body> <?php function array_change_value_case($input, $ucase) { $case = $ucase; $narray = array(); if (!is_array($input)) { return $narray; } foreach ($input as $key => $value) { if (is_array($value)) { $narray[$key] = array_change_value_case($value, $case); continue; } $narray[$key] = ($case == CASE_UPPER ? strtoupper($value) : strtolower($value)); } return $narray; } $Names = array('A' => 'Abdul Azim', 'B' => 'Abdul Rahman', 'c' => 'Arshad Ayub'); echo 'Actual array </br>'; print_r($Names); echo '</br>Values are in lower case.</br>'; $myNames = array_change_value_case($Names,CASE_LOWER); print_r($myNames); echo '</br>Values are in upper case.</br>'; $myNames = array_change_value_case($Names,CASE_UPPER); print_r($myNames); ?> </html> </body>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OfGai
function name:  (null)
number of ops:  26
compiled vars:  !0 = $Names, !1 = $myNames
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%3Chtml%3E%0A%3Cbody%3E%0A%0A'
   25     1        ASSIGN                                                   !0, <array>
   26     2        ECHO                                                     'Actual+array+%3C%2Fbr%3E'
   27     3        INIT_FCALL                                               'print_r'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                                 
   28     6        ECHO                                                     '%3C%2Fbr%3EValues+are+in+lower+case.%3C%2Fbr%3E'
   29     7        INIT_FCALL                                               'array_change_value_case'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 0
         10        DO_FCALL                                      0  $4      
         11        ASSIGN                                                   !1, $4
   30    12        INIT_FCALL                                               'print_r'
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                                 
   31    15        ECHO                                                     '%3C%2Fbr%3EValues+are+in+upper+case.%3C%2Fbr%3E'
   32    16        INIT_FCALL                                               'array_change_value_case'
         17        SEND_VAR                                                 !0
         18        SEND_VAL                                                 1
         19        DO_FCALL                                      0  $7      
         20        ASSIGN                                                   !1, $7
   33    21        INIT_FCALL                                               'print_r'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                                 
   34    24        ECHO                                                     '++%0A%0A%3C%2Fhtml%3E%0A%3C%2Fbody%3E'
   37    25      > RETURN                                                   1

Function array_change_value_case:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 34
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 34
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 20
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 27
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
filename:       /in/OfGai
function name:  array_change_value_case
number of ops:  37
compiled vars:  !0 = $input, !1 = $ucase, !2 = $case, !3 = $narray, !4 = $value, !5 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        ASSIGN                                                   !2, !1
    8     3        ASSIGN                                                   !3, <array>
    9     4        TYPE_CHECK                                  128  ~8      !0
          5        BOOL_NOT                                         ~9      ~8
          6      > JMPZ                                                     ~9, ->8
   11     7    > > RETURN                                                   !3
   13     8    > > FE_RESET_R                                       $10     !0, ->34
          9    > > FE_FETCH_R                                       ~11     $10, !4, ->34
         10    >   ASSIGN                                                   !5, ~11
   15    11        TYPE_CHECK                                  128          !4
         12      > JMPZ                                                     ~13, ->20
   17    13    >   INIT_FCALL_BY_NAME                                       'array_change_value_case'
         14        SEND_VAR_EX                                              !4
         15        SEND_VAR_EX                                              !2
         16        DO_FCALL                                      0  $15     
         17        ASSIGN_DIM                                               !3, !5
         18        OP_DATA                                                  $15
   18    19      > JMP                                                      ->9
   20    20    >   IS_EQUAL                                                 !2, 1
         21      > JMPZ                                                     ~17, ->27
         22    >   INIT_FCALL                                               'strtoupper'
         23        SEND_VAR                                                 !4
         24        DO_ICALL                                         $18     
         25        QM_ASSIGN                                        ~19     $18
         26      > JMP                                                      ->31
         27    >   INIT_FCALL                                               'strtolower'
         28        SEND_VAR                                                 !4
         29        DO_ICALL                                         $20     
         30        QM_ASSIGN                                        ~19     $20
         31    >   ASSIGN_DIM                                               !3, !5
         32        OP_DATA                                                  ~19
   13    33      > JMP                                                      ->9
         34    >   FE_FREE                                                  $10
   22    35      > RETURN                                                   !3
   23    36*     > RETURN                                                   null

End of function array_change_value_case

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.59 ms | 1403 KiB | 21 Q