3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); # THE RESULT HERE IS KINDA KOOL BUT I'M NOT SURE IF I MADE IT WORSE OR BETTER BY STUFFING AROUND WITHOUT A PLAN ! function most_frequent(array $list_to_search) { // print_r($list_to_search);#DEBUG if (count($list_to_search) === 0) return ['', 0]; $it = new ArrayIterator($list_to_search); $counter = 0; $num = $list_to_search[0]; foreach ($it as $i) { $curr_frequency = 0; foreach (new ArrayIterator($list_to_search) as $j) { if ($j === $i) { $curr_frequency++; } } if ($curr_frequency > $counter) { $counter = $curr_frequency; $num = $i; } } return [$num, $counter]; } interface ReToken extends Countable { public function is_empty(): bool; public function get_head(): string; public function has_head(): bool; public function get_tail(): string; public function has_tail(): bool; public function create_without_head(): ReToken; public function create_without_tail(): ReToken; } /** * A string split by [A-Z]+[] */ class ReSingleToken implements ReToken { private iterable $vals; public function __construct(string $val) { // echo 'ReSingleToken('.$val.')'.PHP_EOL;#DEBUG $regexV1 = '/([A-Z]*[a-z_0-9]*)(?=[A-Z]+)/'; $regexV2 = '~([A-Z]?[^A-Z]+|[A-Z]+(?=[A-Z][^A-Z]|$))~'; $words = preg_split($regexV2,$val,-1, PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE); // print_r($words);#DEBUG $this->vals = $words; // print_r(['"'.$val.'"', $words]);#DEBUG } public function __toString(): string { return implode('', $this->vals); } public function count(): int { return count($this->vals); } public function is_empty(): bool { return count($this) === 0; } public function get_head(): string { return count($this) > 0 ? $this->vals[0] : ''; } public function has_head(): bool { return true; } public function get_tail(): string { return count($this) > 0 ? $this->vals[array_key_last($this->vals)] : ''; } public function has_tail(): bool { return true; } public function create_without_head(): ReSingleToken { $vals = $this->vals; if ($this->has_head()) { array_shift($vals); } return new ReSingleToken(implode('', $vals)); } public function create_without_tail(): ReSingleToken { $vals = $this->vals; if ($this->has_tail()) { array_pop($vals); } return new ReSingleToken(implode('', $vals)); } } class ReGroup implements ReToken, RecursiveIterator { public function __construct( private iterable $tokens, private $commonBeginning, private $commonEnding, private bool $optional = false ) { // echo 'ReGroup(['.implode(',', $tokens).'], commonBeginning='.$commonBeginning.', commonEnding='.$commonEnding.', optional='.(string)$optional.')'.PHP_EOL;#DEBUG foreach ($tokens as $key => $value) { if ($value->is_empty()) { unset($this->tokens[$key]); $this->optional = true; } } } /** * Sets the tokens that are not empty string and makes the object optional * if any are empty. * * @param iterable $tokens The tokens that represent the alternation group. */ public function setTokens(iterable $tokens) { $this->tokens = []; $this->optional = false; foreach ($tokens as $token) { if ((string)$token === '') $this->optional = true; else $this->tokens[] = $token; } } public function tryToOptimize() { while (true) { // get all token heads $tokenHeads = []; foreach ($this->tokens as $token) { if ($token->has_head()) { $tokenHeads[] = $token->get_head(); } } list($head_most_popular, $head_count) = most_frequent($tokenHeads); // get all token tails $tokenTails = []; foreach ($this->tokens as $token) { if ($token->has_tail()) { $tokenTails[] = $token->get_tail(); } } list($tail_most_popular, $tail_count) = most_frequent($tokenTails); // all tokens have same head if ($head_count > 1 and $head_count === count($this->tokens)) { $tokenGroup = []; // $optional = false; foreach ($this->tokens as $token) { $token = $token->create_without_head(); $tokenGroup[] = $token; // if ((string)$token === '') // $optional = true; } // $this->tokens = [new ReGroup($tokenGroup, $head_most_popular, '', $optional)]; $this->setTokens($tokenGroup); $this->commonBeginning = $head_most_popular; $this->commonEnding = ''; // echo 'grouped by popular head: '.__LINE__.PHP_EOL;#DEBUG continue; } // all tokens have same tail if ($tail_count > 1 and $tail_count === count($this->tokens)) { $tokenGroup = []; // $optional = false; foreach ($this->tokens as $token) { $token = $token->create_without_tail(); $tokenGroup[] = $token; // if ((string)$token === '') // $optional = true; } // $this->tokens = [new ReGroup($tokenGroup, '', $tail_most_popular, $optional)]; $this->setTokens($tokenGroup); $this->commonBeginning = ''; $this->commonEnding = $tail_most_popular; // echo 'grouped by popular tail: '.__LINE__.PHP_EOL;#DEBUG continue; } if ($head_count >= $tail_count) { if ($head_count < 2) { // echo '//############################################################################//';#DEBUG // print_r(get_defined_vars());#DEBUG // echo 'no common groups: '.__LINE__.PHP_EOL;#DEBUG break; } $tokensNoHead = []; $tokensOther = []; $optional = false; foreach ($this->tokens as $token) { if ($token->get_head() === $head_most_popular) { $token = $token->create_without_head(); $tokensNoHead[] = $token; if ((string)$token === '') $optional = true; } else $tokensOther[] = $token; } $newGroup = new ReGroup($tokensNoHead, $head_most_popular, '', $optional); $this->tokens = [$newGroup, ...$tokensOther]; } else { if ($tail_count < 2) { // echo 'no common groups: '.__LINE__.PHP_EOL;#DEBUG break; } $tokensNoTail = []; $tokensOther = []; $optional = false; foreach ($this->tokens as $token) { if ($token->get_tail() === $tail_most_popular) { $token = $token->create_without_tail(); $tokensNoTail[] = $token; if ((string)$token === '') $optional = true; } else $tokensOther[] = $token; } $newGroup = new ReGroup($tokensNoTail, '', $tail_most_popular, $optional); $this->tokens = [$newGroup, ...$tokensOther]; } } // $tokens = []; // foreach ($this->tokens as $token) { // if ($token instanceof ReSingleToken and $token->get_head() === '') { // $tokens[] = $token; // } // } // if (count($tokens) > 0) { // #check if group has '' -> make optional // $this->optional = true; // $tokens = []; // foreach ($this->tokens as $token) { // if (!$token instanceof ReSingleToken or $token->get_head() !== '') { // $tokens[] = $token; // } // } // } foreach ($this->tokens as $group) { if ($group instanceof ReGroup) { $group->tryToOptimize(); } } } public function __toString(): string { $tokens = []; foreach ($this->tokens as $token) { $tokens[] = $token->__toString(); } $ret = $this->commonBeginning.'('.implode('|', $tokens).')'.($this->optional ? '?' : '').$this->commonEnding; // echo $ret.PHP_EOL;#DEBUG return $ret; } public function count(): int { return count($this->tokens); } public function is_empty(): bool { return count($this) === 0; } public function get_head(): string { return (string)$this->commonBeginning; } public function has_head(): bool { return (string)$this->commonBeginning != ''; } public function get_tail(): string { return (string)$this->commonEnding; } public function has_tail(): bool { return (string)$this->commonEnding != ''; } public function create_without_head(): ReGroup { return new ReGroup($this->tokens, '', $this->commonEnding, $this->optional); } public function create_without_tail(): ReGroup { return new ReGroup($this->tokens, $this->commonBeginning, '', $this->optional); } // ~~~>>> Iterator <<<~~~ //\ private int $position = 0; public function current(): mixed { return $this->tokens[$this->position]; } public function key(): mixed { return $this->position; } public function next(): void { $this->position++; } public function rewind(): void { $this->position = 0; } public function valid(): bool { return count($this) > $this->position; } // ~~~>>> RecursiveIterator <<<~~~ // public function getChildren(): ?RecursiveIterator { return $this->tokens; } public function hasChildren(): bool { return (bool)count($this); } } $for_test = [ '(A|B|C|D)', '(A|B|C|DA)', '(A|B|C|AD)', '(Example|ArrayIterator|RecursiveArrayIterator|DirectoryIterator|RecursiveDirectoryIterator)', '(Example|DOMNode|DOMText|DOMElement)' ]; $for_test[] = '('.implode( '|', array_filter( get_declared_classes(), function ($value) { return !(bool)strpos($value, '\\'); } ) ).')'; foreach ($for_test as $init) { // print_r(preg_split('/([A-Z]*[a-z_0-9]*)(?=[A-Z]+)/',substr($init, 1, -1),-1, PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE)); // continue; echo PHP_EOL.PHP_EOL.'----'.PHP_EOL.PHP_EOL; $inita = substr($init, 1, -1); $tokens = []; $strings = explode('|', $inita); foreach ($strings as $token) { $tokens[] = new ReSingleToken($token); } $r = new ReGroup($tokens, '', '', false); $r->tryToOptimize(); // print_r($r); echo $init.' => '.$r; foreach ($r as $token) { if ($token instanceof ReGroup) $token->tryToOptimize(); } echo PHP_EOL.PHP_EOL.$r.PHP_EOL.PHP_EOL; $tree = new RecursiveTreeIterator($r); foreach ($tree as $key => $value) { echo $value.PHP_EOL; } } /** RANDOM NOTES JUST KEEPING CAUSE I'M TOO TIRED TO GO THROUGH IT NOW * (Sngle|Sngle) * Group = Sngle(Sngle|Sngle)Sngle * * Token can have head/tail * * Sngle split into words: * - starting with upper case character * - all uppercase before a word ^ * head/tail = first/last word * * Group split into Sngle * head/tail = common head/tail * * for a group, * get all heads * if any match * group them with heads removed * rebuild tokens with group and remaining tokens * * Abcdef(Ghijk|Lmnop)?Vwxyz * ^pre ^attrib opt^^post * * prefixToken(tokens)suffixToken * * @todo 🟡 what if the common head and tail counts are equal? */

Abusive script

This script was stopped while abusing our resources

Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 79
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 79
Branch analysis from position: 21
2 jumps found. (Code = 77) Position 1 = 35, Position 2 = 42
Branch analysis from position: 35
2 jumps found. (Code = 78) Position 1 = 36, Position 2 = 42
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
Branch analysis from position: 42
2 jumps found. (Code = 77) Position 1 = 56, Position 2 = 62
Branch analysis from position: 56
2 jumps found. (Code = 78) Position 1 = 57, Position 2 = 62
Branch analysis from position: 57
2 jumps found. (Code = 43) Position 1 = 59, Position 2 = 61
Branch analysis from position: 59
1 jumps found. (Code = 42) Position 1 = 56
Branch analysis from position: 56
Branch analysis from position: 61
Branch analysis from position: 62
2 jumps found. (Code = 77) Position 1 = 72, Position 2 = 77
Branch analysis from position: 72
2 jumps found. (Code = 78) Position 1 = 73, Position 2 = 77
Branch analysis from position: 73
1 jumps found. (Code = 42) Position 1 = 72
Branch analysis from position: 72
Branch analysis from position: 77
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 77
Branch analysis from position: 62
Branch analysis from position: 42
Branch analysis from position: 79
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 79
filename:       /in/TbnPu
function name:  (null)
number of ops:  81
compiled vars:  !0 = $for_test, !1 = $init, !2 = $inita, !3 = $tokens, !4 = $strings, !5 = $token, !6 = $r, !7 = $tree, !8 = $value, !9 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   DECLARE_CLASS                                            'retoken'
   41     1        DECLARE_CLASS                                            'resingletoken'
  101     2        DECLARE_CLASS                                            'regroup'
  329     3        ASSIGN                                                   !0, <array>
  337     4        INIT_FCALL                                               'implode'
  338     5        SEND_VAL                                                 '%7C'
  339     6        INIT_FCALL                                               'array_filter'
  340     7        INIT_FCALL                                               'get_declared_classes'
          8        DO_ICALL                                         $12     
          9        SEND_VAR                                                 $12
  341    10        DECLARE_LAMBDA_FUNCTION                          ~13     [0]
         11        SEND_VAL                                                 ~13
  339    12        DO_ICALL                                         $14     
  341    13        SEND_VAR                                                 $14
  337    14        DO_ICALL                                         $15     
  341    15        CONCAT                                           ~16     '%28', $15
  343    16        CONCAT                                           ~17     ~16, '%29'
  337    17        ASSIGN_DIM                                               !0
  343    18        OP_DATA                                                  ~17
  345    19      > FE_RESET_R                                       $18     !0, ->79
         20    > > FE_FETCH_R                                               $18, !1, ->79
  348    21    >   ECHO                                                     '%0A%0A----%0A%0A'
  349    22        INIT_FCALL                                               'substr'
         23        SEND_VAR                                                 !1
         24        SEND_VAL                                                 1
         25        SEND_VAL                                                 -1
         26        DO_ICALL                                         $19     
         27        ASSIGN                                                   !2, $19
  350    28        ASSIGN                                                   !3, <array>
  351    29        INIT_FCALL                                               'explode'
         30        SEND_VAL                                                 '%7C'
         31        SEND_VAR                                                 !2
         32        DO_ICALL                                         $22     
         33        ASSIGN                                                   !4, $22
  352    34      > FE_RESET_R                                       $24     !4, ->42
         35    > > FE_FETCH_R                                               $24, !5, ->42
  353    36    >   NEW                                              $26     'ReSingleToken'
         37        SEND_VAR_EX                                              !5
         38        DO_FCALL                                      0          
         39        ASSIGN_DIM                                               !3
         40        OP_DATA                                                  $26
  352    41      > JMP                                                      ->35
         42    >   FE_FREE                                                  $24
  355    43        NEW                                              $28     'ReGroup'
         44        SEND_VAR_EX                                              !3
         45        SEND_VAL_EX                                              ''
         46        SEND_VAL_EX                                              ''
         47        SEND_VAL_EX                                              <false>
         48        DO_FCALL                                      0          
         49        ASSIGN                                                   !6, $28
  356    50        INIT_METHOD_CALL                                         !6, 'tryToOptimize'
         51        DO_FCALL                                      0          
  358    52        CONCAT                                           ~32     !1, '+%3D%3E+'
         53        CONCAT                                           ~33     ~32, !6
         54        ECHO                                                     ~33
  359    55      > FE_RESET_R                                       $34     !6, ->62
         56    > > FE_FETCH_R                                               $34, !5, ->62
  360    57    >   INSTANCEOF                                               !5, 'ReGroup'
         58      > JMPZ                                                     ~35, ->61
  361    59    >   INIT_METHOD_CALL                                         !5, 'tryToOptimize'
         60        DO_FCALL                                      0          
  359    61    > > JMP                                                      ->56
         62    >   FE_FREE                                                  $34
  363    63        CONCAT                                           ~37     '%0A%0A', !6
         64        CONCAT                                           ~38     ~37, '%0A'
         65        CONCAT                                           ~39     ~38, '%0A'
         66        ECHO                                                     ~39
  364    67        NEW                                              $40     'RecursiveTreeIterator'
         68        SEND_VAR_EX                                              !6
         69        DO_FCALL                                      0          
         70        ASSIGN                                                   !7, $40
  365    71      > FE_RESET_R                                       $43     !7, ->77
         72    > > FE_FETCH_R                                       ~44     $43, !8, ->77
         73    >   ASSIGN                                                   !9, ~44
  366    74        CONCAT                                           ~46     !8, '%0A'
         75        ECHO                                                     ~46
  365    76      > JMP                                                      ->72
         77    >   FE_FREE                                                  $43
  345    78      > JMP                                                      ->20
         79    >   FE_FREE                                                  $18
  397    80      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  341     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'strpos'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '%5C'
          4        DO_ICALL                                         $1      
          5        BOOL                                             ~2      $1
          6        BOOL_NOT                                         ~3      ~2
          7      > RETURN                                                   ~3
          8*     > RETURN                                                   null

End of Dynamic Function 0

Function most_frequent:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 30
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 30
Branch analysis from position: 14
2 jumps found. (Code = 77) Position 1 = 19, Position 2 = 24
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 23
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 23
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 29
Branch analysis from position: 24
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/TbnPu
function name:  most_frequent
number of ops:  35
compiled vars:  !0 = $list_to_search, !1 = $it, !2 = $counter, !3 = $num, !4 = $i, !5 = $curr_frequency, !6 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        COUNT                                            ~7      !0
          2        IS_IDENTICAL                                             ~7, 0
          3      > JMPZ                                                     ~8, ->5
    9     4    > > RETURN                                                   <array>
   10     5    >   NEW                                              $9      'ArrayIterator'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $9
   11     9        ASSIGN                                                   !2, 0
   12    10        FETCH_DIM_R                                      ~13     !0, 0
         11        ASSIGN                                                   !3, ~13
   13    12      > FE_RESET_R                                       $15     !1, ->30
         13    > > FE_FETCH_R                                               $15, !4, ->30
   14    14    >   ASSIGN                                                   !5, 0
   15    15        NEW                                              $17     'ArrayIterator'
         16        SEND_VAR_EX                                              !0
         17        DO_FCALL                                      0          
         18      > FE_RESET_R                                       $19     $17, ->24
         19    > > FE_FETCH_R                                               $19, !6, ->24
   16    20    >   IS_IDENTICAL                                             !6, !4
         21      > JMPZ                                                     ~20, ->23
   17    22    >   PRE_INC                                                  !5
   15    23    > > JMP                                                      ->19
         24    >   FE_FREE                                                  $19
   20    25        IS_SMALLER                                               !2, !5
         26      > JMPZ                                                     ~22, ->29
   21    27    >   ASSIGN                                                   !2, !5
   22    28        ASSIGN                                                   !3, !4
   13    29    > > JMP                                                      ->13
         30    >   FE_FREE                                                  $15
   25    31        INIT_ARRAY                                       ~25     !3
         32        ADD_ARRAY_ELEMENT                                ~25     !2
         33      > RETURN                                                   ~25
   26    34*     > RETURN                                                   null

End of function most_frequent

Class ReToken:
Function is_empty:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  is_empty
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   VERIFY_RETURN_TYPE                                       
          1      > RETURN                                                   null

End of function is_empty

Function get_head:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  get_head
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   VERIFY_RETURN_TYPE                                       
          1      > RETURN                                                   null

End of function get_head

Function has_head:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  has_head
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   VERIFY_RETURN_TYPE                                       
          1      > RETURN                                                   null

End of function has_head

Function get_tail:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  get_tail
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   VERIFY_RETURN_TYPE                                       
          1      > RETURN                                                   null

End of function get_tail

Function has_tail:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  has_tail
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   VERIFY_RETURN_TYPE                                       
          1      > RETURN                                                   null

End of function has_tail

Function create_without_head:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  create_without_head
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   VERIFY_RETURN_TYPE                                       
          1      > RETURN                                                   null

End of function create_without_head

Function create_without_tail:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  create_without_tail
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   VERIFY_RETURN_TYPE                                       
          1      > RETURN                                                   null

End of function create_without_tail

End of class ReToken.

Class ReSingleToken:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  __construct
number of ops:  13
compiled vars:  !0 = $val, !1 = $regexV1, !2 = $regexV2, !3 = $words
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   RECV                                             !0      
   46     1        ASSIGN                                                   !1, '%2F%28%5BA-Z%5D%2A%5Ba-z_0-9%5D%2A%29%28%3F%3D%5BA-Z%5D%2B%29%2F'
   47     2        ASSIGN                                                   !2, '%7E%28%5BA-Z%5D%3F%5B%5EA-Z%5D%2B%7C%5BA-Z%5D%2B%28%3F%3D%5BA-Z%5D%5B%5EA-Z%5D%7C%24%29%29%7E'
   48     3        INIT_FCALL                                               'preg_split'
          4        SEND_VAR                                                 !2
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 -1
          7        SEND_VAL                                                 3
          8        DO_ICALL                                         $6      
          9        ASSIGN                                                   !3, $6
   50    10        ASSIGN_OBJ                                               'vals'
         11        OP_DATA                                                  !3
   52    12      > RETURN                                                   null

End of function __construct

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  __toString
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   55     0  E >   INIT_FCALL                                               'implode'
          1        SEND_VAL                                                 ''
          2        FETCH_OBJ_R                                      ~0      'vals'
          3        SEND_VAL                                                 ~0
          4        DO_ICALL                                         $1      
          5        VERIFY_RETURN_TYPE                                       $1
          6      > RETURN                                                   $1
   56     7*       VERIFY_RETURN_TYPE                                       
          8*     > RETURN                                                   null

End of function __tostring

Function count:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  count
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   59     0  E >   FETCH_OBJ_R                                      ~0      'vals'
          1        COUNT                                            ~1      ~0
          2        VERIFY_RETURN_TYPE                                       ~1
          3      > RETURN                                                   ~1
   60     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function count

Function is_empty:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  is_empty
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   63     0  E >   FETCH_THIS                                       ~0      
          1        COUNT                                            ~1      ~0
          2        IS_IDENTICAL                                     ~2      ~1, 0
          3        VERIFY_RETURN_TYPE                                       ~2
          4      > RETURN                                                   ~2
   64     5*       VERIFY_RETURN_TYPE                                       
          6*     > RETURN                                                   null

End of function is_empty

Function get_head:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  get_head
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   67     0  E >   FETCH_THIS                                       ~0      
          1        COUNT                                            ~1      ~0
          2        IS_SMALLER                                               0, ~1
          3      > JMPZ                                                     ~2, ->8
          4    >   FETCH_OBJ_R                                      ~3      'vals'
          5        FETCH_DIM_R                                      ~4      ~3, 0
          6        QM_ASSIGN                                        ~5      ~4
          7      > JMP                                                      ->9
          8    >   QM_ASSIGN                                        ~5      ''
          9    >   VERIFY_RETURN_TYPE                                       ~5
         10      > RETURN                                                   ~5
   68    11*       VERIFY_RETURN_TYPE                                       
         12*     > RETURN                                                   null

End of function get_head

Function has_head:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  has_head
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   71     0  E > > RETURN                                                   <true>
   72     1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function has_head

Function get_tail:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  get_tail
number of ops:  17
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   75     0  E >   FETCH_THIS                                       ~0      
          1        COUNT                                            ~1      ~0
          2        IS_SMALLER                                               0, ~1
          3      > JMPZ                                                     ~2, ->12
          4    >   INIT_FCALL                                               'array_key_last'
          5        FETCH_OBJ_R                                      ~4      'vals'
          6        SEND_VAL                                                 ~4
          7        DO_ICALL                                         $5      
          8        FETCH_OBJ_R                                      ~3      'vals'
          9        FETCH_DIM_R                                      ~6      ~3, $5
         10        QM_ASSIGN                                        ~7      ~6
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~7      ''
         13    >   VERIFY_RETURN_TYPE                                       ~7
         14      > RETURN                                                   ~7
   76    15*       VERIFY_RETURN_TYPE                                       
         16*     > RETURN                                                   null

End of function get_tail

Function has_tail:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TbnPu
function name:  has_tail
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   79     0  E > > RETURN                                                   <true>
   80     1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function has_tail

Function create_without_head:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/TbnPu
function name:  create_without_head
number of ops:  19
compiled vars:  !0 = $vals
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   83     0  E >   FETCH_OBJ_R                                      ~1      'vals'
          1        ASSIGN                                                   !0, ~1
   84     2        INIT_METHOD_CALL                                         'has_head'
          3        DO_FCALL                                      0  $3      
          4      > JMPZ                                                     $3, ->8
   86     5    >   INIT_FCALL                                               'array_shift'
          6        SEND_REF                                                 !0
          7        DO_ICALL                                                 
   88     8    >   NEW                                              $5      'ReSingleToken'
          9        INIT_FCALL                                               'implode'
         10        SEND_VAL                                                 ''
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $6      
         13        SEND_VAR_NO_REF_EX                                       $6
         14        DO_FCALL                                      0          
         15        VERIFY_RETURN_TYPE                                       $5
         16      > RETURN                                                   $5
   89    17*       VERIFY_RETURN_TYPE                                       
         18*     > RETURN                                                   null

End of function create_without_head

Function create_without_tail:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/TbnPu
function name:  create_without_tail
number of ops:  19
compiled vars:  !0 = $vals
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   92     0  E >   FETCH_OBJ_R                                      ~1      'vals'
          1        ASSIGN                                                   !0, ~1
   93     2        INIT_METHOD_CALL                                         'has_tail'
          3        DO_FCALL                                      0  $3      
          4      > JMPZ                                                     $3, ->8
   95     5    >   INIT_FCALL                                               'array_pop'
          6        SEND_REF                                                 !0
          7        DO_ICALL                                                 
   97     8    >   NEW                                              $5      'ReSingleToken'
          9        INIT_FCALL                                               'implode'
         10        SEND_VAL                                                 ''
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $6      
         13        SEND_VAR_NO_REF_EX                                       $6
         14        DO_FCALL                                      0          
         15        VERIFY_RETURN_TYPE                                       $5
         16      > RETURN                                                   $5
   98    17*       VERIFY_RETURN_TYPE                                       
         18*     > RETURN                                                   null

End of function create_without_tail

End of class ReSingleToken.

Class ReGroup:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 23
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 23
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 22
Branch analysis from position: 23
1 jumps found. (Code = 62) 

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
207.45 ms | 1048 KiB | 23 Q