3v4l.org

run code in 300+ PHP versions simultaneously
<?php function v1($value) { return implode(array_map(function($value) { return ucfirst($value); }, explode('_', $value))); } function v2($value) { return preg_replace_callback('/([A-Z])/', function($char) { return '_'.strtolower($char[1]); }, lcfirst($value)); } function v3($value){ return preg_replace('/_(.?)/e',"strtoupper('$1')",$value); } for($x = 0; $x < 10000; $x++){ $foo = v2('foo_bar_baz_bee'); if($x = 0) echo $foo; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 2
Branch analysis from position: 12
Branch analysis from position: 2
Branch analysis from position: 9
filename:       /in/FUvZc
function name:  (null)
number of ops:  13
compiled vars:  !0 = $x, !1 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->10
   16     2    >   INIT_FCALL                                               'v2'
          3        SEND_VAL                                                 'foo_bar_baz_bee'
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !1, $3
   17     6        ASSIGN                                           ~5      !0, 0
          7      > JMPZ                                                     ~5, ->9
          8    >   ECHO                                                     !1
   15     9    >   PRE_INC                                                  !0
         10    >   IS_SMALLER                                               !0, 10000
         11      > JMPNZ                                                    ~7, ->2
   18    12    > > RETURN                                                   1

Function v1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FUvZc
function name:  v1
number of ops:  15
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'implode'
          2        INIT_FCALL                                               'array_map'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FFUvZc%3A3%240'
          4        SEND_VAL                                                 ~1
          5        INIT_FCALL                                               'explode'
          6        SEND_VAL                                                 '_'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $2      
          9        SEND_VAR                                                 $2
         10        DO_ICALL                                         $3      
         11        SEND_VAR                                                 $3
         12        DO_ICALL                                         $4      
         13      > RETURN                                                   $4
    4    14*     > RETURN                                                   null

End of function v1

Function %00%7Bclosure%7D%2Fin%2FFUvZc%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FUvZc
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'ucfirst'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
          5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FFUvZc%3A3%240

Function v2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FUvZc
function name:  v2
number of ops:  12
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%2F%28%5BA-Z%5D%29%2F'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FFUvZc%3A7%241'
          4        SEND_VAL                                                 ~1
          5        INIT_FCALL                                               'lcfirst'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                         $3      
         10      > RETURN                                                   $3
    8    11*     > RETURN                                                   null

End of function v2

Function %00%7Bclosure%7D%2Fin%2FFUvZc%3A7%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FUvZc
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $char
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'strtolower'
          2        FETCH_DIM_R                                      ~1      !0, 1
          3        SEND_VAL                                                 ~1
          4        DO_ICALL                                         $2      
          5        CONCAT                                           ~3      '_', $2
          6      > RETURN                                                   ~3
          7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FFUvZc%3A7%241

Function v3:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FUvZc
function name:  v3
number of ops:  8
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 '%2F_%28.%3F%29%2Fe'
          3        SEND_VAL                                                 'strtoupper%28%27%241%27%29'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $1      
          6      > RETURN                                                   $1
   13     7*     > RETURN                                                   null

End of function v3

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.12 ms | 1403 KiB | 30 Q