3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Benchmark { private $startTime; private $endTime; public function start() { $this->startTime = hrtime(true); } public function end() { $this->endTime = hrtime(true); } public function getElapsedTime() { return round(($this->endTime - $this->startTime) / 1_000_000_000, 8); } } // Example usage $benchmark = new Benchmark(); // ==================================== // PREPARE TEST DATA class A { private array $strings = []; public function prettifyTestMethodName1(string $name): string { if ($name === '') { return ''; } $string = rtrim($name, '0123456789'); if (array_key_exists($string, $this->strings)) { $name = $string; } elseif ($string === $name) { $this->strings[$string] = 1; } if (str_starts_with($name, 'test_')) { $name = substr($name, 5); } elseif (str_starts_with($name, 'test')) { $name = substr($name, 4); } if ($name === '') { return ''; } $name[0] = strtoupper($name[0]); $noUnderscore = str_replace('_', ' ', $name); if ($noUnderscore !== $name) { return trim($noUnderscore); } $wasNumeric = false; $buffer = ''; $len = strlen($name); for ($i = 0; $i < $len; $i++) { if ($i > 0 && $name[$i] >= 'A' && $name[$i] <= 'Z') { $buffer .= ' ' . strtolower($name[$i]); } else { $isNumeric = $name[$i] >= '0' && $name[$i] <= '9'; if (!$wasNumeric && $isNumeric) { $buffer .= ' '; $wasNumeric = true; } if ($wasNumeric && !$isNumeric) { $wasNumeric = false; } $buffer .= $name[$i]; } } return trim($buffer); } public function prettifyTestMethodName2(string $name): string { if ($name === '') { return ''; } $string = rtrim($name, '0123456789'); if (array_key_exists($string, $this->strings)) { $name = $string; } elseif ($string === $name) { $this->strings[$string] = 1; } if (str_starts_with($name, 'test_')) { $name = substr($name, 5); } elseif (str_starts_with($name, 'test')) { $name = substr($name, 4); } if ($name === '') { return ''; } $name = ucfirst($name); $noUnderscore = str_replace('_', ' ', $name); if ($noUnderscore !== $name) { return trim($noUnderscore); } $buffer = preg_replace_callback_array( [ '/(?!^)([A-Z])/' => static fn (array $matches) => ' ' . strtolower($matches[1]), '/(\d+)/' => static fn (array $matches) => ' ' . $matches[1], ], $name, ); return trim($buffer); } } class TestAbcdefghijabcdefGhijabcdefghijabcdefGhijabcdefghijabcdefghija23423bcdefghijabc2defghijabcdefghijabcdefghij { } // ==================================== $memory = memory_get_usage(); echo "Initial memory usage: " . ($memory / 1024) . " KB\n"; $benchmark->start(); // Code to benchmark for ($i = 0; $i < 100000; $i++) { $test1 = (new A())->prettifyTestMethodName1(TestAbcdefghijabcdefGhijabcdefghijabcdefGhijabcdefghijabcdefghija23423bcdefghijabc2defghijabcdefghijabcdefghij::class); } $benchmark->end(); $time1 = $benchmark->getElapsedTime(); echo "Elapsed time: " . $time1 . " seconds\n"; $memory = memory_get_usage(); echo "Memory usage after test 2: " . ($memory / 1024) . " KB\n"; echo "-----------------------------------\n"; $memory = memory_get_usage(); echo "Initial memory usage: " . ($memory / 1024) . " KB\n"; $benchmark->start(); // Code to benchmark for ($i = 0; $i < 100000; $i++) { $test2 = (new A())->prettifyTestMethodName2(TestAbcdefghijabcdefGhijabcdefghijabcdefGhijabcdefghijabcdefghija23423bcdefghijabc2defghijabcdefghijabcdefghij::class); } $benchmark->end(); $time2 = $benchmark->getElapsedTime(); echo "Elapsed time: " . $time2 . " seconds\n"; $memory = memory_get_usage(); echo "Memory usage after test 2: " . ($memory / 1024) . " KB\n"; echo "Times faster: " . round($time1 / $time2, 2) . "x\n"; assert($test1 === $test2, 'The two methods should produce the same result.' . var_export($test1, true) . ' !== ' . var_export($test2, true));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 14
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 50
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 50
Branch analysis from position: 59
Branch analysis from position: 50
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 14
Branch analysis from position: 23
Branch analysis from position: 14
filename:       /in/iH2iu
function name:  (null)
number of ops:  100
compiled vars:  !0 = $benchmark, !1 = $memory, !2 = $i, !3 = $test1, !4 = $time1, !5 = $test2, !6 = $time2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   NEW                                              $7      'Benchmark'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $7
  145     3        INIT_FCALL                                               'memory_get_usage'
          4        DO_ICALL                                         $10     
          5        ASSIGN                                                   !1, $10
  146     6        DIV                                              ~12     !1, 1024
          7        CONCAT                                           ~13     'Initial+memory+usage%3A+', ~12
          8        CONCAT                                           ~14     ~13, '+KB%0A'
          9        ECHO                                                     ~14
  147    10        INIT_METHOD_CALL                                         !0, 'start'
         11        DO_FCALL                                      0          
  149    12        ASSIGN                                                   !2, 0
         13      > JMP                                                      ->21
  150    14    >   NEW                                              $17     'A'
         15        DO_FCALL                                      0          
         16        INIT_METHOD_CALL                                         $17, 'prettifyTestMethodName1'
         17        SEND_VAL_EX                                              'TestAbcdefghijabcdefGhijabcdefghijabcdefGhijabcdefghijabcdefghija23423bcdefghijabc2defghijabcdefghijabcdefghij'
         18        DO_FCALL                                      0  $19     
         19        ASSIGN                                                   !3, $19
  149    20        PRE_INC                                                  !2
         21    >   IS_SMALLER                                               !2, 100000
         22      > JMPNZ                                                    ~22, ->14
  153    23    >   INIT_METHOD_CALL                                         !0, 'end'
         24        DO_FCALL                                      0          
  154    25        INIT_METHOD_CALL                                         !0, 'getElapsedTime'
         26        DO_FCALL                                      0  $24     
         27        ASSIGN                                                   !4, $24
  155    28        CONCAT                                           ~26     'Elapsed+time%3A+', !4
         29        CONCAT                                           ~27     ~26, '+seconds%0A'
         30        ECHO                                                     ~27
  156    31        INIT_FCALL                                               'memory_get_usage'
         32        DO_ICALL                                         $28     
         33        ASSIGN                                                   !1, $28
  157    34        DIV                                              ~30     !1, 1024
         35        CONCAT                                           ~31     'Memory+usage+after+test+2%3A+', ~30
         36        CONCAT                                           ~32     ~31, '+KB%0A'
         37        ECHO                                                     ~32
  159    38        ECHO                                                     '-----------------------------------%0A'
  161    39        INIT_FCALL                                               'memory_get_usage'
         40        DO_ICALL                                         $33     
         41        ASSIGN                                                   !1, $33
  162    42        DIV                                              ~35     !1, 1024
         43        CONCAT                                           ~36     'Initial+memory+usage%3A+', ~35
         44        CONCAT                                           ~37     ~36, '+KB%0A'
         45        ECHO                                                     ~37
  163    46        INIT_METHOD_CALL                                         !0, 'start'
         47        DO_FCALL                                      0          
  165    48        ASSIGN                                                   !2, 0
         49      > JMP                                                      ->57
  166    50    >   NEW                                              $40     'A'
         51        DO_FCALL                                      0          
         52        INIT_METHOD_CALL                                         $40, 'prettifyTestMethodName2'
         53        SEND_VAL_EX                                              'TestAbcdefghijabcdefGhijabcdefghijabcdefGhijabcdefghijabcdefghija23423bcdefghijabc2defghijabcdefghijabcdefghij'
         54        DO_FCALL                                      0  $42     
         55        ASSIGN                                                   !5, $42
  165    56        PRE_INC                                                  !2
         57    >   IS_SMALLER                                               !2, 100000
         58      > JMPNZ                                                    ~45, ->50
  169    59    >   INIT_METHOD_CALL                                         !0, 'end'
         60        DO_FCALL                                      0          
  170    61        INIT_METHOD_CALL                                         !0, 'getElapsedTime'
         62        DO_FCALL                                      0  $47     
         63        ASSIGN                                                   !6, $47
  171    64        CONCAT                                           ~49     'Elapsed+time%3A+', !6
         65        CONCAT                                           ~50     ~49, '+seconds%0A'
         66        ECHO                                                     ~50
  172    67        INIT_FCALL                                               'memory_get_usage'
         68        DO_ICALL                                         $51     
         69        ASSIGN                                                   !1, $51
  173    70        DIV                                              ~53     !1, 1024
         71        CONCAT                                           ~54     'Memory+usage+after+test+2%3A+', ~53
         72        CONCAT                                           ~55     ~54, '+KB%0A'
         73        ECHO                                                     ~55
  174    74        INIT_FCALL                                               'round'
         75        DIV                                              ~56     !4, !6
         76        SEND_VAL                                                 ~56
         77        SEND_VAL                                                 2
         78        DO_ICALL                                         $57     
         79        CONCAT                                           ~58     'Times+faster%3A+', $57
         80        CONCAT                                           ~59     ~58, 'x%0A'
         81        ECHO                                                     ~59
  176    82        ASSERT_CHECK                                             
         83        INIT_FCALL                                               'assert'
         84        IS_IDENTICAL                                     ~60     !3, !5
         85        SEND_VAL                                                 ~60
         86        INIT_FCALL                                               'var_export'
         87        SEND_VAR                                                 !3
         88        SEND_VAL                                                 <true>
         89        DO_ICALL                                         $61     
         90        CONCAT                                           ~62     'The+two+methods+should+produce+the+same+result.', $61
         91        CONCAT                                           ~63     ~62, '+%21%3D%3D+'
         92        INIT_FCALL                                               'var_export'
         93        SEND_VAR                                                 !5
         94        SEND_VAL                                                 <true>
         95        DO_ICALL                                         $64     
         96        CONCAT                                           ~65     ~63, $64
         97        SEND_VAL                                                 ~65
         98        DO_ICALL                                                 
         99      > RETURN                                                   1

Class Benchmark:
Function start:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iH2iu
function name:  start
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'hrtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $1      
          3        ASSIGN_OBJ                                               'startTime'
          4        OP_DATA                                                  $1
   12     5      > RETURN                                                   null

End of function start

Function end:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iH2iu
function name:  end
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'hrtime'
          1        SEND_VAL                                                 <true>
          2        DO_ICALL                                         $1      
          3        ASSIGN_OBJ                                               'endTime'
          4        OP_DATA                                                  $1
   17     5      > RETURN                                                   null

End of function end

Function getelapsedtime:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iH2iu
function name:  getElapsedTime
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'round'
          1        FETCH_OBJ_R                                      ~0      'endTime'
          2        FETCH_OBJ_R                                      ~1      'startTime'
          3        SUB                                              ~2      ~0, ~1
          4        DIV                                              ~3      ~2, 1000000000
          5        SEND_VAL                                                 ~3
          6        SEND_VAL                                                 8
          7        DO_ICALL                                         $4      
          8      > RETURN                                                   $4
   22     9*     > RETURN                                                   null

End of function getelapsedtime

End of class Benchmark.

Class A:
Function prettifytestmethodname1:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 30
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 43
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 62
Branch analysis from position: 57
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 62
1 jumps found. (Code = 42) Position 1 = 106
Branch analysis from position: 106
2 jumps found. (Code = 44) Position 1 = 108, Position 2 = 68
Branch analysis from position: 108
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 68
2 jumps found. (Code = 46) Position 1 = 70, Position 2 = 73
Branch analysis from position: 70
2 jumps found. (Code = 46) Position 1 = 74, Position 2 = 77
Branch analysis from position: 74
2 jumps found. (Code = 43) Position 1 = 78, Position 2 = 85
Branch analysis from position: 78
1 jumps found. (Code = 42) Position 1 = 105
Branch analysis from position: 105
2 jumps found. (Code = 44) Position 1 = 108, Position 2 = 68
Branch analysis from position: 108
Branch analysis from position: 68
Branch analysis from position: 85
2 jumps found. (Code = 46) Position 1 = 88, Position 2 = 91
Branch analysis from position: 88
2 jumps found. (Code = 46) Position 1 = 94, Position 2 = 95
Branch analysis from position: 94
2 jumps found. (Code = 43) Position 1 = 96, Position 2 = 98
Branch analysis from position: 96
2 jumps found. (Code = 46) Position 1 = 99, Position 2 = 101
Branch analysis from position: 99
2 jumps found. (Code = 43) Position 1 = 102, Position 2 = 103
Branch analysis from position: 102
2 jumps found. (Code = 44) Position 1 = 108, Position 2 = 68
Branch analysis from position: 108
Branch analysis from position: 68
Branch analysis from position: 103
Branch analysis from position: 101
Branch analysis from position: 98
Branch analysis from position: 95
Branch analysis from position: 91
Branch analysis from position: 77
Branch analysis from position: 73
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 40
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 43
Branch analysis from position: 42
Branch analysis from position: 43
Branch analysis from position: 40
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 30
Branch analysis from position: 24
Branch analysis from position: 30
Branch analysis from position: 19
filename:       /in/iH2iu
function name:  prettifyTestMethodName1
number of ops:  115
compiled vars:  !0 = $name, !1 = $string, !2 = $noUnderscore, !3 = $wasNumeric, !4 = $buffer, !5 = $len, !6 = $i, !7 = $isNumeric
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   RECV                                             !0      
   37     1        IS_IDENTICAL                                             !0, ''
          2      > JMPZ                                                     ~8, ->4
   38     3    > > RETURN                                                   ''
   41     4    >   INIT_FCALL                                               'rtrim'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 '0123456789'
          7        DO_ICALL                                         $9      
          8        ASSIGN                                                   !1, $9
   43     9        FETCH_OBJ_R                                      ~11     'strings'
         10        ARRAY_KEY_EXISTS                                         !1, ~11
         11      > JMPZ                                                     ~12, ->14
   44    12    >   ASSIGN                                                   !0, !1
   43    13      > JMP                                                      ->19
   45    14    >   IS_IDENTICAL                                             !1, !0
         15      > JMPZ                                                     ~14, ->19
   46    16    >   FETCH_OBJ_W                                      $15     'strings'
         17        ASSIGN_DIM                                               $15, !1
         18        OP_DATA                                                  1
   49    19    >   INIT_FCALL                                               'str_starts_with'
         20        SEND_VAR                                                 !0
         21        SEND_VAL                                                 'test_'
         22        DO_ICALL                                         $17     
         23      > JMPZ                                                     $17, ->30
   50    24    >   INIT_FCALL                                               'substr'
         25        SEND_VAR                                                 !0
         26        SEND_VAL                                                 5
         27        DO_ICALL                                         $18     
         28        ASSIGN                                                   !0, $18
   49    29      > JMP                                                      ->40
   51    30    >   INIT_FCALL                                               'str_starts_with'
         31        SEND_VAR                                                 !0
         32        SEND_VAL                                                 'test'
         33        DO_ICALL                                         $20     
         34      > JMPZ                                                     $20, ->40
   52    35    >   INIT_FCALL                                               'substr'
         36        SEND_VAR                                                 !0
         37        SEND_VAL                                                 4
         38        DO_ICALL                                         $21     
         39        ASSIGN                                                   !0, $21
   55    40    >   IS_IDENTICAL                                             !0, ''
         41      > JMPZ                                                     ~23, ->43
   56    42    > > RETURN                                                   ''
   59    43    >   INIT_FCALL                                               'strtoupper'
         44        FETCH_DIM_R                                      ~25     !0, 0
         45        SEND_VAL                                                 ~25
         46        DO_ICALL                                         $26     
         47        ASSIGN_DIM                                               !0, 0
         48        OP_DATA                                                  $26
   61    49        INIT_FCALL                                               'str_replace'
         50        SEND_VAL                                                 '_'
         51        SEND_VAL                                                 '+'
         52        SEND_VAR                                                 !0
         53        DO_ICALL                                         $27     
         54        ASSIGN                                                   !2, $27
   63    55        IS_NOT_IDENTICAL                                         !2, !0
         56      > JMPZ                                                     ~29, ->62
   64    57    >   INIT_FCALL                                               'trim'
         58        SEND_VAR                                                 !2
         59        DO_ICALL                                         $30     
         60        VERIFY_RETURN_TYPE                                       $30
         61      > RETURN                                                   $30
   67    62    >   ASSIGN                                                   !3, <false>
   69    63        ASSIGN                                                   !4, ''
   71    64        STRLEN                                           ~33     !0
         65        ASSIGN                                                   !5, ~33
   73    66        ASSIGN                                                   !6, 0
         67      > JMP                                                      ->106
   74    68    >   IS_SMALLER                                       ~36     0, !6
         69      > JMPZ_EX                                          ~36     ~36, ->73
         70    >   FETCH_DIM_R                                      ~37     !0, !6
         71        IS_SMALLER_OR_EQUAL                              ~38     'A', ~37
         72        BOOL                                             ~36     ~38
         73    > > JMPZ_EX                                          ~36     ~36, ->77
         74    >   FETCH_DIM_R                                      ~39     !0, !6
         75        IS_SMALLER_OR_EQUAL                              ~40     ~39, 'Z'
         76        BOOL                                             ~36     ~40
         77    > > JMPZ                                                     ~36, ->85
   75    78    >   INIT_FCALL                                               'strtolower'
         79        FETCH_DIM_R                                      ~41     !0, !6
         80        SEND_VAL                                                 ~41
         81        DO_ICALL                                         $42     
         82        CONCAT                                           ~43     '+', $42
         83        ASSIGN_OP                                     8          !4, ~43
   74    84      > JMP                                                      ->105
   77    85    >   FETCH_DIM_R                                      ~45     !0, !6
         86        IS_SMALLER_OR_EQUAL                              ~46     '0', ~45
         87      > JMPZ_EX                                          ~46     ~46, ->91
         88    >   FETCH_DIM_R                                      ~47     !0, !6
         89        IS_SMALLER_OR_EQUAL                              ~48     ~47, '9'
         90        BOOL                                             ~46     ~48
         91    >   ASSIGN                                                   !7, ~46
   79    92        BOOL_NOT                                         ~50     !3
         93      > JMPZ_EX                                          ~50     ~50, ->95
         94    >   BOOL                                             ~50     !7
         95    > > JMPZ                                                     ~50, ->98
   80    96    >   ASSIGN_OP                                     8          !4, '+'
   81    97        ASSIGN                                                   !3, <true>
   84    98    > > JMPZ_EX                                          ~53     !3, ->101
         99    >   BOOL_NOT                                         ~54     !7
        100        BOOL                                             ~53     ~54
        101    > > JMPZ                                                     ~53, ->103
   85   102    >   ASSIGN                                                   !3, <false>
   88   103    >   FETCH_DIM_R                                      ~56     !0, !6
        104        ASSIGN_OP                                     8          !4, ~56
   73   105    >   PRE_INC                                                  !6
        106    >   IS_SMALLER                                               !6, !5
        107      > JMPNZ                                                    ~59, ->68
   92   108    >   INIT_FCALL                                               'trim'
        109        SEND_VAR                                                 !4
        110        DO_ICALL                                         $60     
        111        VERIFY_RETURN_TYPE                                       $60
        112      > RETURN                                                   $60
   93   113*       VERIFY_RETURN_TYPE                                       
        114*     > RETURN                                                   null

End of function prettifytestmethodname1

Function prettifytestmethodname2:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 30
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 43
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 55, Position 2 = 60
Branch analysis from position: 55
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 40
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 43
Branch analysis from position: 42
Branch analysis from position: 43
Branch analysis from position: 40
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 30
Branch analysis from position: 24
Branch analysis from position: 30
Branch analysis from position: 19
filename:       /in/iH2iu
function name:  prettifyTestMethodName2
number of ops:  76
compiled vars:  !0 = $name, !1 = $string, !2 = $noUnderscore, !3 = $buffer
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   95     0  E >   RECV                                             !0      
   97     1        IS_IDENTICAL                                             !0, ''
          2      > JMPZ                                                     ~4, ->4
   98     3    > > RETURN                                                   ''
  101     4    >   INIT_FCALL                                               'rtrim'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 '0123456789'
          7        DO_ICALL                                         $5      
          8        ASSIGN                                                   !1, $5
  103     9        FETCH_OBJ_R                                      ~7      'strings'
         10        ARRAY_KEY_EXISTS                                         !1, ~7
         11      > JMPZ                                                     ~8, ->14
  104    12    >   ASSIGN                                                   !0, !1
  103    13      > JMP                                                      ->19
  105    14    >   IS_IDENTICAL                                             !1, !0
         15      > JMPZ                                                     ~10, ->19
  106    16    >   FETCH_OBJ_W                                      $11     'strings'
         17        ASSIGN_DIM                                               $11, !1
         18        OP_DATA                                                  1
  109    19    >   INIT_FCALL                                               'str_starts_with'
         20        SEND_VAR                                                 !0
         21        SEND_VAL                                                 'test_'
         22        DO_ICALL                                         $13     
         23      > JMPZ                                                     $13, ->30
  110    24    >   INIT_FCALL                                               'substr'
         25        SEND_VAR                                                 !0
         26        SEND_VAL                                                 5
         27        DO_ICALL                                         $14     
         28        ASSIGN                                                   !0, $14
  109    29      > JMP                                                      ->40
  111    30    >   INIT_FCALL                                               'str_starts_with'
         31        SEND_VAR                                                 !0
         32        SEND_VAL                                                 'test'
         33        DO_ICALL                                         $16     
         34      > JMPZ                                                     $16, ->40
  112    35    >   INIT_FCALL                                               'substr'
         36        SEND_VAR                                                 !0
         37        SEND_VAL                                                 4
         38        DO_ICALL                                         $17     
         39        ASSIGN                                                   !0, $17
  115    40    >   IS_IDENTICAL                                             !0, ''
         41      > JMPZ                                                     ~19, ->43
  116    42    > > RETURN                                                   ''
  119    43    >   INIT_FCALL                                               'ucfirst'
         44        SEND_VAR                                                 !0
         45        DO_ICALL                                         $20     
         46        ASSIGN                                                   !0, $20
  121    47        INIT_FCALL                                               'str_replace'
         48        SEND_VAL                                                 '_'
         49        SEND_VAL                                                 '+'
         50        SEND_VAR                                                 !0
         51        DO_ICALL                                         $22     
         52        ASSIGN                                                   !2, $22
  123    53        IS_NOT_IDENTICAL                                         !2, !0
         54      > JMPZ                                                     ~24, ->60
  124    55    >   INIT_FCALL                                               'trim'
         56        SEND_VAR                                                 !2
         57        DO_ICALL                                         $25     
         58        VERIFY_RETURN_TYPE                                 

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.33 ms | 1060 KiB | 26 Q