3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_content() { return ' person_ID,name,first,last,middle,email,phone,fax,title 3130,"Burks, Rosella ",Rosella,Burks,,BurksR@univ.edu,963.555.1253,963.777.4065,Professor 3297,"Avila, Damien ",Damien,Avila,,AvilaD@univ.edu,963.555.1352,963.777.7914,Professor 3547,"Olsen, Robin ",Robin,Olsen,,OlsenR@univ.edu,963.555.1378,963.777.9262,Assistant Professor 1538,"Moises, Edgar Estes",Edgar,Moises,Estes,MoisesE@univ.edu,963.555.2731x3565,963.777.8264,Professor 2941,"Brian, Heath Pruitt",Heath,Brian,Pruitt,BrianH@univ.edu,963.555.2800,963.777.7249,Associate Curator 2401,"Claude, Elvin Haney",Elvin,Claude,Haney,ClaudeE@univ.edu,963.555.2902,963.777.9730,Curator 2070,"Mosley, Edmund ",Edmund,Mosley,,MosleyE@univ.edu,963.555.2945,963.777.9285,Assistant Professor 2561,"Derek, Antoine Mccoy",Antoine,Derek,Mccoy,DerekA@univ.edu,963.555.2992,963.777.5454,Curator 1625,"Hawkins, Callie ",Callie,Hawkins,,HawkinsC@univ.edu,963.555.3350x6480,963.777.4949,Professor 1307,"Pate, Andrea ",Andrea,Pate,,PateA@univ.edu,963.555.3723,963.777.5049,Professor 2342,"Austin, Liz ",Liz,Austin,,AustinL@univ.edu,963.555.4305,963.777.6143,Assistant Professor 2755,"Kendrick, Reba Alford",Reba,Kendrick,Alford,KendrickR@univ.edu,963.555.4618x7744,963.777.4371,Associate Curator 4150,"Sims, Angelina ",Angelina,Sims,,SimsA@univ.edu,963.555.5278,963.777.4400,Professor 3544,"Mullins, Kimberly ",Kimberly,Mullins,,MullinsK@univ.edu,963.555.5471x1017,963.777.9783,Assistant Professor 2096,"Chuck, Lloyd Haney",Lloyd,Chuck,Haney,ChuckL@univ.edu,963.555.5568x2652,963.777.9290,Assistant Professor 1089,"Payne, Ladonna ",Ladonna,Payne,,PayneL@univ.edu,963.555.5639,963.777.6469,Professor 2948,"Baxter, Johnathan Browning",Johnathan,Baxter,Browning,BaxterJ@univ.edu,963.555.5902,963.777.8336,Research Professor 4539,"Weiss, Gilbert ",Gilbert,Weiss,,WeissG@univ.edu,963.555.5969,963.777.4975,Professor 2811,"Deirdre, Florence Barrera",Florence,Deirdre,Barrera,DeirdreF@univ.edu,963.555.6319,963.777.9654,Associate Curator 4580,"Fernando, Toby Calderon",Toby,Fernando,Calderon,FernandoT@univ.edu,963.555.6469,963.777.9864,Research Professor 2895,"Garrison, Patrica ",Patrica,Garrison,,GarrisonP@univ.edu,963.555.6760,963.777.4958,Associate Curator 2254,"Effie, Leila Vinson",Leila,Effie,Vinson,EffieL@univ.edu,963.555.6824,963.777.7299,Assistant Professor 2389,"Buckley, Rose ",Rose,Buckley,,BuckleyR@univ.edu,963.555.6855x5018,963.777.5233,Curator 1699,"Stanton, Kathie ",Kathie,Stanton,,StantonK@univ.edu,963.555.7095,963.777.1015,Professor 1567,"Banks, Shannon ",Shannon,Banks,,BanksS@univ.edu,963.555.7198,963.777.6979,Professor 3066,"Barnes, Cleo ",Cleo,Barnes,,BarnesC@univ.edu,963.555.7463x7335,963.777.1583,Research Professor 2426,"Brady, Nellie ",Nellie,Brady,,BradyN@univ.edu,963.555.7569,963.777.7218,Curator 2217,"Katheryn, Ruben Holt",Ruben,Katheryn,Holt,KatherynR@univ.edu,963.555.7578,963.777.3969,Assistant Professor 1968,"Michael, Dianne ",Dianne,Michael,,MichaelD@univ.edu,963.555.7592,963.777.9960,Assistant Professor 3012,"Grant, Adam ",Adam,Grant,,GrantA@univ.edu,963.555.7775,963.777.8115,Research Professor 1824,"Head, Kurtis ",Kurtis,Head,,HeadK@univ.edu,963.555.7882,963.777.6348,Professor 3929,"Berger, Jami ",Jami,Berger,,BergerJ@univ.edu,963.555.8158,963.777.5650,Research Professor 2682,"Earline, Jaime Fitzgerald",Jaime,Earline,Fitzgerald,EarlineJ@univ.edu,963.555.8357,963.777.4114,Associate Curator 3112,"Evelyn, Summer Frost",Summer,Evelyn,Frost,EvelynS@univ.edu,963.555.8895,963.777.5730,Professor 2303,"Quentin, Sam Hyde",Sam,Quentin,Hyde,QuentinS@univ.edu,963.555.8921,963.777.2712,Assistant Professor 3903,"Dunlap, Ann ",Ann,Dunlap,,DunlapA@univ.edu,963.555.9067,963.777.4290,Assistant Professor 3095,"Shields, Rich Pena",Rich,Shields,Pena,ShieldsR@univ.edu,963.555.9197,963.777.7215,Professor 2383,"Page, Winnie ",Winnie,Page,,PageW@univ.edu,963.555.9366,963.777.3202,Curator 2146,"Sparks, Ezra ",Ezra,Sparks,,SparksE@univ.edu,963.555.9390,963.777.9273,Assistant Professor '; } $capture = array( 1 => [], 2 => [], ); function captures_differ():bool { global $capture; $diff = false; $n = min(count($capture[1]),count($capture[2])); for($i = 0; $i < $n; $i++) { if ($capture[1][$i] === $capture[2][$i]) { continue; } echo "======>\n"; echo $i, ": '",$capture[1][$i], "' !== '", $capture[2][$i], "'\n"; echo "<======\n"; echo "\n"; $diff = true; } return $diff; } // Function to benchmark strtok function benchmarkStrtok($content, $iterations) { // global $capture; $start = microtime(true); for ($i = 0; $i < $iterations; $i++) { $token = strtok($content, ','); while ($token !== false) { // $capture[1][] = $token; $token = strtok(','); } } $end = microtime(true); return $end - $start; } class StringTokenizer { private \Generator $tokenGenerator; public function __construct(public readonly string $string) { } public function nextToken(string $characters): string|null { if (!isset($this->tokenGenerator)) { $this->tokenGenerator = $this->generator($characters); return $this->tokenGenerator->current(); } return $this->tokenGenerator->send($characters); } private function generator(string $characters): \Generator { $pos = 0; while (true) { $pos += \strspn($this->string, $characters, $pos); $len = \strcspn($this->string, $characters, $pos); if (!$len) return; $token = \substr($this->string, $pos, $len); $characters = yield $token; $pos += $len; } } } function strtok2(string $string, ?string $token = null): string|false { static $tokenGenerator = null; if ($token) { $tokenGenerator = (function(string $characters) use ($string): \Generator { $pos = 0; while (true) { $pos += \strspn($string, $characters, $pos); $len = \strcspn($string, $characters, $pos); if ($len === 0) return; $token = \substr($string, $pos, $len); $characters = yield $token; $pos += $len; } })($token); return $tokenGenerator->current() ?? false; } return $tokenGenerator?->send($string) ?? false; } // Function to benchmark explode function benchmarkStrtok2($content, $iterations) { // global $capture; $start = microtime(true); for ($i = 0; $i < $iterations; $i++) { $token = strtok2($content, ','); while ($token !== false) { // $capture[2][] = $token; $token = strtok2(','); } } $end = microtime(true); return $end - $start; } // Main script execution $content = get_content(); $bytes = strlen($content); $commas = count(explode(",",$content))-1; $iterations = 100; $timeStrtok = benchmarkStrtok($content, $iterations); $timeStrtok2 = benchmarkStrtok2($content, $iterations); //if ( captures_differ() ) { // echo "ERROR: Mismatch"; // exit(1); //} $timesFaster = round( $timeStrtok2 / $timeStrtok,4); $timeStrtok = round($timeStrtok,4); $timeStrtok2 = round($timeStrtok2,4); echo "Size of file: $bytes\n"; echo "Number of commas: $commas\n"; echo "Time for strtok: $timeStrtok seconds\n"; echo "Time for strtok2: $timeStrtok2 seconds\n"; echo "strtok() time delta: $timesFaster\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7lXlM
function name:  (null)
number of ops:  61
compiled vars:  !0 = $capture, !1 = $content, !2 = $bytes, !3 = $commas, !4 = $iterations, !5 = $timeStrtok, !6 = $timeStrtok2, !7 = $timesFaster
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   ASSIGN                                                   !0, <array>
  143     1        INIT_FCALL                                               'get_content'
          2        DO_FCALL                                      0  $9      
          3        ASSIGN                                                   !1, $9
  144     4        STRLEN                                           ~11     !1
          5        ASSIGN                                                   !2, ~11
  145     6        INIT_FCALL                                               'explode'
          7        SEND_VAL                                                 '%2C'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $13     
         10        COUNT                                            ~14     $13
         11        SUB                                              ~15     ~14, 1
         12        ASSIGN                                                   !3, ~15
  147    13        ASSIGN                                                   !4, 100
  149    14        INIT_FCALL                                               'benchmarkstrtok'
         15        SEND_VAR                                                 !1
         16        SEND_VAR                                                 !4
         17        DO_FCALL                                      0  $18     
         18        ASSIGN                                                   !5, $18
  150    19        INIT_FCALL                                               'benchmarkstrtok2'
         20        SEND_VAR                                                 !1
         21        SEND_VAR                                                 !4
         22        DO_FCALL                                      0  $20     
         23        ASSIGN                                                   !6, $20
  157    24        INIT_FCALL                                               'round'
         25        DIV                                              ~22     !6, !5
         26        SEND_VAL                                                 ~22
         27        SEND_VAL                                                 4
         28        DO_ICALL                                         $23     
         29        ASSIGN                                                   !7, $23
  159    30        INIT_FCALL                                               'round'
         31        SEND_VAR                                                 !5
         32        SEND_VAL                                                 4
         33        DO_ICALL                                         $25     
         34        ASSIGN                                                   !5, $25
  160    35        INIT_FCALL                                               'round'
         36        SEND_VAR                                                 !6
         37        SEND_VAL                                                 4
         38        DO_ICALL                                         $27     
         39        ASSIGN                                                   !6, $27
  162    40        ROPE_INIT                                     3  ~30     'Size+of+file%3A++++++++'
         41        ROPE_ADD                                      1  ~30     ~30, !2
         42        ROPE_END                                      2  ~29     ~30, '%0A'
         43        ECHO                                                     ~29
  163    44        ROPE_INIT                                     3  ~33     'Number+of+commas%3A++++'
         45        ROPE_ADD                                      1  ~33     ~33, !3
         46        ROPE_END                                      2  ~32     ~33, '%0A'
         47        ECHO                                                     ~32
  164    48        ROPE_INIT                                     3  ~36     'Time+for+strtok%3A+++++'
         49        ROPE_ADD                                      1  ~36     ~36, !5
         50        ROPE_END                                      2  ~35     ~36, '+seconds%0A'
         51        ECHO                                                     ~35
  165    52        ROPE_INIT                                     3  ~39     'Time+for+strtok2%3A++++'
         53        ROPE_ADD                                      1  ~39     ~39, !6
         54        ROPE_END                                      2  ~38     ~39, '+seconds%0A'
         55        ECHO                                                     ~38
  166    56        ROPE_INIT                                     3  ~42     'strtok%28%29+time+delta%3A+'
         57        ROPE_ADD                                      1  ~42     ~42, !7
         58        ROPE_END                                      2  ~41     ~42, '%0A'
         59        ECHO                                                     ~41
         60      > RETURN                                                   1

Function get_content:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7lXlM
function name:  get_content
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E > > RETURN                                                   '%0Aperson_ID%2Cname%2Cfirst%2Clast%2Cmiddle%2Cemail%2Cphone%2Cfax%2Ctitle%0A3130%2C%22Burks%2C+Rosella+%22%2CRosella%2CBurks%2C%2CBurksR%40univ.edu%2C963.555.1253%2C963.777.4065%2CProfessor%0A3297%2C%22Avila%2C+Damien+%22%2CDamien%2CAvila%2C%2CAvilaD%40univ.edu%2C963.555.1352%2C963.777.7914%2CProfessor%0A3547%2C%22Olsen%2C+Robin+%22%2CRobin%2COlsen%2C%2COlsenR%40univ.edu%2C963.555.1378%2C963.777.9262%2CAssistant+Professor%0A1538%2C%22Moises%2C+Edgar+Estes%22%2CEdgar%2CMoises%2CEstes%2CMoisesE%40univ.edu%2C963.555.2731x3565%2C963.777.8264%2CProfessor%0A2941%2C%22Brian%2C+Heath+Pruitt%22%2CHeath%2CBrian%2CPruitt%2CBrianH%40univ.edu%2C963.555.2800%2C963.777.7249%2CAssociate+Curator%0A2401%2C%22Claude%2C+Elvin+Haney%22%2CElvin%2CClaude%2CHaney%2CClaudeE%40univ.edu%2C963.555.2902%2C963.777.9730%2CCurator%0A2070%2C%22Mosley%2C+Edmund+%22%2CEdmund%2CMosley%2C%2CMosleyE%40univ.edu%2C963.555.2945%2C963.777.9285%2CAssistant+Professor%0A2561%2C%22Derek%2C+Antoine+Mccoy%22%2CAntoine%2CDerek%2CMccoy%2CDerekA%40univ.edu%2C963.555.2992%2C963.777.5454%2CCurator%0A1625%2C%22Hawkins%2C+Callie+%22%2CCallie%2CHawkins%2C%2CHawkinsC%40univ.edu%2C963.555.3350x6480%2C963.777.4949%2CProfessor%0A1307%2C%22Pate%2C+Andrea+%22%2CAndrea%2CPate%2C%2CPateA%40univ.edu%2C963.555.3723%2C963.777.5049%2CProfessor%0A2342%2C%22Austin%2C+Liz+%22%2CLiz%2CAustin%2C%2CAustinL%40univ.edu%2C963.555.4305%2C963.777.6143%2CAssistant+Professor%0A2755%2C%22Kendrick%2C+Reba+Alford%22%2CReba%2CKendrick%2CAlford%2CKendrickR%40univ.edu%2C963.555.4618x7744%2C963.777.4371%2CAssociate+Curator%0A4150%2C%22Sims%2C+Angelina+%22%2CAngelina%2CSims%2C%2CSimsA%40univ.edu%2C963.555.5278%2C963.777.4400%2CProfessor%0A3544%2C%22Mullins%2C+Kimberly+%22%2CKimberly%2CMullins%2C%2CMullinsK%40univ.edu%2C963.555.5471x1017%2C963.777.9783%2CAssistant+Professor%0A2096%2C%22Chuck%2C+Lloyd+Haney%22%2CLloyd%2CChuck%2CHaney%2CChuckL%40univ.edu%2C963.555.5568x2652%2C963.777.9290%2CAssistant+Professor%0A1089%2C%22Payne%2C+Ladonna+%22%2CLadonna%2CPayne%2C%2CPayneL%40univ.edu%2C963.555.5639%2C963.777.6469%2CProfessor%0A2948%2C%22Baxter%2C+Johnathan+Browning%22%2CJohnathan%2CBaxter%2CBrowning%2CBaxterJ%40univ.edu%2C963.555.5902%2C963.777.8336%2CResearch+Professor%0A4539%2C%22Weiss%2C+Gilbert+%22%2CGilbert%2CWeiss%2C%2CWeissG%40univ.edu%2C963.555.5969%2C963.777.4975%2CProfessor%0A2811%2C%22Deirdre%2C+Florence+Barrera%22%2CFlorence%2CDeirdre%2CBarrera%2CDeirdreF%40univ.edu%2C963.555.6319%2C963.777.9654%2CAssociate+Curator%0A4580%2C%22Fernando%2C+Toby+Calderon%22%2CToby%2CFernando%2CCalderon%2CFernandoT%40univ.edu%2C963.555.6469%2C963.777.9864%2CResearch+Professor%0A2895%2C%22Garrison%2C+Patrica+%22%2CPatrica%2CGarrison%2C%2CGarrisonP%40univ.edu%2C963.555.6760%2C963.777.4958%2CAssociate+Curator%0A2254%2C%22Effie%2C+Leila+Vinson%22%2CLeila%2CEffie%2CVinson%2CEffieL%40univ.edu%2C963.555.6824%2C963.777.7299%2CAssistant+Professor%0A2389%2C%22Buckley%2C+Rose+%22%2CRose%2CBuckley%2C%2CBuckleyR%40univ.edu%2C963.555.6855x5018%2C963.777.5233%2CCurator%0A1699%2C%22Stanton%2C+Kathie+%22%2CKathie%2CStanton%2C%2CStantonK%40univ.edu%2C963.555.7095%2C963.777.1015%2CProfessor%0A1567%2C%22Banks%2C+Shannon+%22%2CShannon%2CBanks%2C%2CBanksS%40univ.edu%2C963.555.7198%2C963.777.6979%2CProfessor%0A3066%2C%22Barnes%2C+Cleo+%22%2CCleo%2CBarnes%2C%2CBarnesC%40univ.edu%2C963.555.7463x7335%2C963.777.1583%2CResearch+Professor%0A2426%2C%22Brady%2C+Nellie+%22%2CNellie%2CBrady%2C%2CBradyN%40univ.edu%2C963.555.7569%2C963.777.7218%2CCurator%0A2217%2C%22Katheryn%2C+Ruben+Holt%22%2CRuben%2CKatheryn%2CHolt%2CKatherynR%40univ.edu%2C963.555.7578%2C963.777.3969%2CAssistant+Professor%0A1968%2C%22Michael%2C+Dianne+%22%2CDianne%2CMichael%2C%2CMichaelD%40univ.edu%2C963.555.7592%2C963.777.9960%2CAssistant+Professor%0A3012%2C%22Grant%2C+Adam+%22%2CAdam%2CGrant%2C%2CGrantA%40univ.edu%2C963.555.7775%2C963.777.8115%2CResearch+Professor%0A1824%2C%22Head%2C+Kurtis+%22%2CKurtis%2CHead%2C%2CHeadK%40univ.edu%2C963.555.7882%2C963.777.6348%2CProfessor%0A3929%2C%22Berger%2C+Jami+%22%2CJami%2CBerger%2C%2CBergerJ%40univ.edu%2C963.555.8158%2C963.777.5650%2CResearch+Professor%0A2682%2C%22Earline%2C+Jaime+Fitzgerald%22%2CJaime%2CEarline%2CFitzgerald%2CEarlineJ%40univ.edu%2C963.555.8357%2C963.777.4114%2CAssociate+Curator%0A3112%2C%22Evelyn%2C+Summer+Frost%22%2CSummer%2CEvelyn%2CFrost%2CEvelynS%40univ.edu%2C963.555.8895%2C963.777.5730%2CProfessor%0A2303%2C%22Quentin%2C+Sam+Hyde%22%2CSam%2CQuentin%2CHyde%2CQuentinS%40univ.edu%2C963.555.8921%2C963.777.2712%2CAssistant+Professor%0A3903%2C%22Dunlap%2C+Ann+%22%2CAnn%2CDunlap%2C%2CDunlapA%40univ.edu%2C963.555.9067%2C963.777.4290%2CAssistant+Professor%0A3095%2C%22Shields%2C+Rich+Pena%22%2CRich%2CShields%2CPena%2CShieldsR%40univ.edu%2C963.555.9197%2C963.777.7215%2CProfessor%0A2383%2C%22Page%2C+Winnie+%22%2CWinnie%2CPage%2C%2CPageW%40univ.edu%2C963.555.9366%2C963.777.3202%2CCurator%0A2146%2C%22Sparks%2C+Ezra+%22%2CEzra%2CSparks%2C%2CSparksE%40univ.edu%2C963.555.9390%2C963.777.9273%2CAssistant+Professor%0A'
   45     1*     > RETURN                                                   null

End of function get_content

Function captures_differ:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 13
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 13
Branch analysis from position: 37
Branch analysis from position: 13
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 13
Branch analysis from position: 37
Branch analysis from position: 13
filename:       /in/7lXlM
function name:  captures_differ
number of ops:  41
compiled vars:  !0 = $capture, !1 = $diff, !2 = $n, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   51     0  E >   BIND_GLOBAL                                              !0, 'capture'
   52     1        ASSIGN                                                   !1, <false>
   53     2        INIT_FCALL                                               'min'
          3        FETCH_DIM_R                                      ~5      !0, 1
          4        COUNT                                            ~6      ~5
          5        SEND_VAL                                                 ~6
          6        FETCH_DIM_R                                      ~7      !0, 2
          7        COUNT                                            ~8      ~7
          8        SEND_VAL                                                 ~8
          9        DO_ICALL                                         $9      
         10        ASSIGN                                                   !2, $9
   54    11        ASSIGN                                                   !3, 0
         12      > JMP                                                      ->35
   55    13    >   FETCH_DIM_R                                      ~12     !0, 1
         14        FETCH_DIM_R                                      ~13     ~12, !3
         15        FETCH_DIM_R                                      ~14     !0, 2
         16        FETCH_DIM_R                                      ~15     ~14, !3
         17        IS_IDENTICAL                                             ~13, ~15
         18      > JMPZ                                                     ~16, ->20
   56    19    > > JMP                                                      ->34
   58    20    >   ECHO                                                     '%3D%3D%3D%3D%3D%3D%3E%0A'
   59    21        ECHO                                                     !3
         22        ECHO                                                     '%3A+%27'
         23        FETCH_DIM_R                                      ~17     !0, 1
         24        FETCH_DIM_R                                      ~18     ~17, !3
         25        ECHO                                                     ~18
         26        ECHO                                                     '%27+%21%3D%3D+%27'
         27        FETCH_DIM_R                                      ~19     !0, 2
         28        FETCH_DIM_R                                      ~20     ~19, !3
         29        ECHO                                                     ~20
         30        ECHO                                                     '%27%0A'
   60    31        ECHO                                                     '%3C%3D%3D%3D%3D%3D%3D%0A'
   61    32        ECHO                                                     '%0A'
   62    33        ASSIGN                                                   !1, <true>
   54    34    >   PRE_INC                                                  !3
         35    >   IS_SMALLER                                               !3, !2
         36      > JMPNZ                                                    ~23, ->13
   64    37    >   VERIFY_RETURN_TYPE                                       !1
         38      > RETURN                                                   !1
   65    39*       VERIFY_RETURN_TYPE                                       
         40*     > RETURN                                                   null

End of function captures_differ

Function benchmarkstrtok:
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 = 8
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 14
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 8
Branch analysis from position: 23
Branch analysis from position: 8
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 14
Branch analysis from position: 20
Branch analysis from position: 14
filename:       /in/7lXlM
function name:  benchmarkStrtok
number of ops:  30
compiled vars:  !0 = $content, !1 = $iterations, !2 = $start, !3 = $i, !4 = $token, !5 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   67     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   69     2        INIT_FCALL                                               'microtime'
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !2, $6
   70     6        ASSIGN                                                   !3, 0
          7      > JMP                                                      ->21
   71     8    >   INIT_FCALL                                               'strtok'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 '%2C'
         11        DO_ICALL                                         $9      
         12        ASSIGN                                                   !4, $9
   72    13      > JMP                                                      ->18
   74    14    >   INIT_FCALL                                               'strtok'
         15        SEND_VAL                                                 '%2C'
         16        DO_ICALL                                         $11     
         17        ASSIGN                                                   !4, $11
   72    18    >   TYPE_CHECK                                  1018          !4
         19      > JMPNZ                                                    ~13, ->14
   70    20    >   PRE_INC                                                  !3
         21    >   IS_SMALLER                                               !3, !1
         22      > JMPNZ                                                    ~15, ->8
   77    23    >   INIT_FCALL                                               'microtime'
         24        SEND_VAL                                                 <true>
         25        DO_ICALL                                         $16     
         26        ASSIGN                                                   !5, $16
   78    27        SUB                                              ~18     !5, !2
         28      > RETURN                                                   ~18
   79    29*     > RETURN                                                   null

End of function benchmarkstrtok

Function strtok2:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 16
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7lXlM
function name:  strtok2
number of ops:  26
compiled vars:  !0 = $string, !1 = $token, !2 = $tokenGenerator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  108     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
  109     2        BIND_STATIC                                              !2
  110     3      > JMPZ                                                     !1, ->16
  111     4    >   DECLARE_LAMBDA_FUNCTION                          ~3      [0]
          5        BIND_LEXICAL                                             ~3, !0
  122     6        INIT_DYNAMIC_CALL                                        ~3
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0  $4      
  111     9        ASSIGN                                                   !2, $4
  123    10        INIT_METHOD_CALL                                         !2, 'current'
         11        DO_FCALL                                      0  $6      
         12        COALESCE                                         ~7      $6
         13        QM_ASSIGN                                        ~7      <false>
         14        VERIFY_RETURN_TYPE                                       ~7
         15      > RETURN                                                   ~7
  125    16    >   JMP_NULL                                         $8      !2
         17        INIT_METHOD_CALL                                         !2, 'send'
         18        SEND_VAR_EX                                              !0
         19        DO_FCALL                                      0  $8      
         20        COALESCE                                         ~9      $8
         21        QM_ASSIGN                                        ~9      <false>
         22        VERIFY_RETURN_TYPE                                       ~9
         23      > RETURN                                                   ~9
  126    24*       VERIFY_RETURN_TYPE                                       
         25*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 5
Branch analysis from position: 30
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 5
Branch analysis from position: 30
Branch analysis from position: 5
filename:       /in/7lXlM
function name:  {closure}
number of ops:  31
compiled vars:  !0 = $characters, !1 = $string, !2 = $pos, !3 = $len, !4 = $token
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  111     0  E >   RECV                                             !0      
          1        GENERATOR_CREATE                                         
          2        BIND_STATIC                                              !1
  112     3        ASSIGN                                                   !2, 0
  113     4      > JMP                                                      ->29
  114     5    >   INIT_FCALL                                               'strspn'
          6        SEND_VAR                                                 !1
          7        SEND_VAR                                                 !0
          8        SEND_VAR                                                 !2
          9        DO_ICALL                                         $6      
         10        ASSIGN_OP                                     1          !2, $6
  115    11        INIT_FCALL                                               'strcspn'
         12        SEND_VAR                                                 !1
         13        SEND_VAR                                                 !0
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $8      
         16        ASSIGN                                                   !3, $8
  116    17        IS_IDENTICAL                                             !3, 0
         18      > JMPZ                                                     ~10, ->20
  117    19    > > GENERATOR_RETURN                                         
  118    20    >   INIT_FCALL                                               'substr'
         21        SEND_VAR                                                 !1
         22        SEND_VAR                                                 !2
         23        SEND_VAR                                                 !3
         24        DO_ICALL                                         $11     
         25        ASSIGN                                                   !4, $11
  119    26        YIELD                                            $13     !4
         27        ASSIGN                                                   !0, $13
  120    28        ASSIGN_OP                                     1          !2, !3
  113    29    > > JMPNZ                                                    <true>, ->5
  122    30    > > GENERATOR_RETURN                                         

End of Dynamic Function 0

End of function strtok2

Function benchmarkstrtok2:
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 = 8
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 14
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 8
Branch analysis from position: 23
Branch analysis from position: 8
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 14
Branch analysis from position: 20
Branch analysis from position: 14
filename:       /in/7lXlM
function name:  benchmarkStrtok2
number of ops:  30
compiled vars:  !0 = $content, !1 = $iterations, !2 = $start, !3 = $i, !4 = $token, !5 = $end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  129     0  E >   RECV                                             !0      
          1        RECV                                             !1      
  131     2        INIT_FCALL                                               'microtime'
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !2, $6
  132     6        ASSIGN                                                   !3, 0
          7      > JMP                                                      ->21
  133     8    >   INIT_FCALL                                               'strtok2'
          9        SEND_VAR                                                 !0
         10        SEND_VAL                                                 '%2C'
         11        DO_FCALL                                      0  $9      
         12        ASSIGN                                                   !4, $9
  134    13      > JMP                                                      ->18
  136    14    >   INIT_FCALL                                               'strtok2'
         15        SEND_VAL                                                 '%2C'
         16        DO_FCALL                                      0  $11     
         17        ASSIGN                                                   !4, $11
  134    18    >   TYPE_CHECK                                  1018          !4
         19      > JMPNZ                                                    ~13, ->14
  132    20    >   PRE_INC                                                  !3
         21    >   IS_SMALLER                                               !3, !1
         22      > JMPNZ                                                    ~15, ->8
  139    23    >   INIT_FCALL                                               'microtime'
         24        SEND_VAL                                                 <true>
         25        DO_ICALL                                         $16     
         26        ASSIGN                                                   !5, $16
  140    27        SUB                                              ~18     !5, !2
         28      > RETURN                                                   ~18
  141    29*     > RETURN                                                   null

End of function benchmarkstrtok2

Class StringTokenizer:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7lXlM
function name:  __construct
number of ops:  4
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   83     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'string'
          2        OP_DATA                                                  !0
   84     3      > RETURN                                                   null

End of function __construct

Function nexttoken:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7lXlM
function name:  nextToken
number of ops:  22
compiled vars:  !0 = $characters
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   86     0  E >   RECV                                             !0      
   87     1        ISSET_ISEMPTY_PROP_OBJ                           ~1      'tokenGenerator'
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->14
   88     4    >   INIT_METHOD_CALL                                         'generator'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0  $4      
          7        ASSIGN_OBJ                                               'tokenGenerator'
          8        OP_DATA                                                  $4
   89     9        FETCH_OBJ_R                                      ~5      'tokenGenerator'
         10        INIT_METHOD_CALL                                         ~5, 'current'
         11        DO_FCALL                                      0  $6      
         12        VERIFY_RETURN_TYPE                                       $6
         13      > RETURN                                                   $6
   91    14    >   FETCH_OBJ_R                                      ~7      'tokenGenerator'
         15        INIT_METHOD_CALL                                         ~7, 'send'
         16        SEND_VAR_EX                                              !0
         17        DO_FCALL                                      0  $8      
         18        VERIFY_RETURN_TYPE                                       $8
         19      > RETURN                                                   $8
   92    20*       VERIFY_RETURN_TYPE                                       
         21*     > RETURN                                                   null

End of function nexttoken

Function generator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 4
Branch analysis from position: 32
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 21
Branch analysis from position: 20
1 jumps found. (Code = 161) Position 1 = -2
Branch

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.47 ms | 1469 KiB | 26 Q