3v4l.org

run code in 300+ PHP versions simultaneously
<?php function intdiv_1($a, $b){ return ($a - $a % $b) / $b; } function int_div($dividend, $divisor){ $res; if (function_exists('intdiv')) $res=intdiv($dividend, $divisor); else // < php7 $res=intdiv_1($dividend, $divisor); return $res; } class Sheet { private $size; //1,2 or 4 private $sections=array()/* = array(4) { "1"=>null, "2"=>null, "3"=>null, "4"=>null }*/; public function __construct($dim, $arg) { $this->size = $dim; if (is_array($arg)==true && sizeof($arg)==$dim) {//building a sheet of 2 or 4 $i=1; foreach($arg as $elem) $this->sections[$i++]=$elem; return; } else { if (is_array($arg)==false && $dim==1) //buidling a sheet of 1 $this->sections[1]= $arg; else throw new Exception("Incompatible arguments"); } } public function __toString() { $ret='-'; foreach($this->sections as $key=>$val) $ret .= (string)$val; return $ret.'-'; } public function divide(){ //return first the left or upper section of the shhet $ret1; //left or upper part of the sheet $ret2; //right or lower part of the shet switch($this->size) { case 4: //vertical cut $arr1=array($this->sections[1],$this->sections[3]); $ret1=new Sheet(2,$arr1); $arr2=array($this->sections[2],$this->sections[4]); $ret2=new Sheet(2,$arr2); break; case 2: //horizontal cut $ret1 = new Sheet(1,$this->sections[1]); $ret2 = new Sheet(1,$this->sections[2]); break; default: throw new Exception("Value must be 2 or 4"); } $this->size /= 2; return array($ret1,$ret2); } public function toArray(){ $ret=[]; foreach($this->sections as $val) $ret[]=$val; return $ret; } } class SheetPile{ private $sheets=array(); private $sheetSize; public function __construct($size){ $this->sheetSize=$size; } public function __toString() { $ret='A stack of '.$this->sheetSize."-sized sheets:\n"; foreach($this->sheets as $val) $ret .= (string)$val."\n"; return $ret; } public function add($sheet){ //sheets are stacked one below the other starting from the upper one array_push($this->sheets, $sheet); } public function divide(){ //return first the left or upper section of the pile in form of SheetPiles $pile1=new SheetPile($this->sheetSize/2); $pile2=new SheetPile($this->sheetSize/2); switch($this->sheetSize) { case 2:case 4: //horizontal(2) or vertical(4) cut foreach($this->sheets as $elem){ list($s1,$s2)= $elem->divide(); $pile1->add($s1); $pile2->add($s2); } break; default: throw new Exception("Value must be 2 or 4"); } return array($pile1,$pile2); } public function stackUp(){ //left pile ($this) is placed over the right one, upper pile ($this) over the other list($pile1,$pile2)=$this->divide(); $pile1->sheets = array_merge($pile1->sheets,$pile2->sheets); return $pile1; } public function SingleSheetPile_To_Array(){ if ($this->sheetSize!=1) throw new Exception("This function applies only to Pile of Sheets with size 1"); else { $ret=[]; foreach($this->sheets as $elem) $ret=array_merge($ret,$elem->toArray()); return $ret; } } } function A4toA6($num_pages) { $n =1+int_div($num_pages-1, 4); $arr; $pp=1; for($i=1;$i<=$n;$i++){ for($j=0;$j<4;$j++){ $val=$i+$j*$n; $arr[$i][$j]=($val>$num_pages)?" ":$val; //arr[page][quarter(0-3 from left to right from top to bottom] } } return $arr; } function verify_A4toA6($num_pages) { $arr=A4toA6($num_pages); $pile=new SheetPile(4); foreach($arr as $val){ //for every page $sheet4 = new Sheet(4,$val); $pile->add($sheet4); } $pile=$pile->stackUp(); //from 4 to 2 $pile=$pile->stackUp(); //from 2 to 1 $pages=[]; for($i=1;$i<=$num_pages;$i++) $pages[]=$i; return $pages==$pile->SingleSheetPile_To_Array(); } print_r(3==3);print_r(3==33); print("SHEEEEEET\n"); $s1 = new Sheet(1,0);print($s1."\n"); $s2 = new Sheet(2,array(2,4));print($s2."\n"); list($a,$b)=$s2->divide();print("V:\n");print($a."\n");print($b); $s4 = new Sheet(4,array(3,5,7,9));print("\n".$s4."\n"); print("sheetdiv\n"); list($a,$b)=$s4->divide();print("\nH:\n");print($a."\n");print($b); print("PILEEEEEE\n"); $q1 = new Sheet(4,array(1,3,5,7));$q2 = new Sheet(4,array(2,4,6,8)); $p = new SheetPile(4); $p->add($q1);$p->add($q2);print($p); $d1=new Sheet(2,array(2,4)); $d2 = new Sheet(2,array(7,8)); $pp = new SheetPile(2);$pp->add($d1);$pp->add($d2);print($pp); $u1=new Sheet(1,4); $u2=new Sheet(1,1); $ppp = new SheetPile(1);$ppp->add($u1);$ppp->add($u2);print($ppp); print("pilediv\n"); print_r($p->stackUp()->stackUp()->SingleSheetPile_To_Array()); print_r(verify_A4toA6(8));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/psb75
function name:  (null)
number of ops:  135
compiled vars:  !0 = $s1, !1 = $s2, !2 = $a, !3 = $b, !4 = $s4, !5 = $q1, !6 = $q2, !7 = $p, !8 = $d1, !9 = $d2, !10 = $pp, !11 = $u1, !12 = $u2, !13 = $ppp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   DECLARE_CLASS                                            'sheet'
   71     1        DECLARE_CLASS                                            'sheetpile'
  145     2        INIT_FCALL                                               'print_r'
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                                 
          5        INIT_FCALL                                               'print_r'
          6        SEND_VAL                                                 <false>
          7        DO_ICALL                                                 
  146     8        ECHO                                                     'SHEEEEEET%0A'
  147     9        NEW                                              $16     'Sheet'
         10        SEND_VAL_EX                                              1
         11        SEND_VAL_EX                                              0
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !0, $16
         14        CONCAT                                           ~19     !0, '%0A'
         15        ECHO                                                     ~19
  148    16        NEW                                              $20     'Sheet'
         17        SEND_VAL_EX                                              2
         18        SEND_VAL_EX                                              <array>
         19        DO_FCALL                                      0          
         20        ASSIGN                                                   !1, $20
         21        CONCAT                                           ~23     !1, '%0A'
         22        ECHO                                                     ~23
  149    23        INIT_METHOD_CALL                                         !1, 'divide'
         24        DO_FCALL                                      0  $24     
         25        FETCH_LIST_R                                     $25     $24, 0
         26        ASSIGN                                                   !2, $25
         27        FETCH_LIST_R                                     $27     $24, 1
         28        ASSIGN                                                   !3, $27
         29        FREE                                                     $24
         30        ECHO                                                     'V%3A%0A'
         31        CONCAT                                           ~29     !2, '%0A'
         32        ECHO                                                     ~29
         33        ECHO                                                     !3
  150    34        NEW                                              $30     'Sheet'
         35        SEND_VAL_EX                                              4
         36        SEND_VAL_EX                                              <array>
         37        DO_FCALL                                      0          
         38        ASSIGN                                                   !4, $30
         39        CONCAT                                           ~33     '%0A', !4
         40        CONCAT                                           ~34     ~33, '%0A'
         41        ECHO                                                     ~34
  151    42        ECHO                                                     'sheetdiv%0A'
  152    43        INIT_METHOD_CALL                                         !4, 'divide'
         44        DO_FCALL                                      0  $35     
         45        FETCH_LIST_R                                     $36     $35, 0
         46        ASSIGN                                                   !2, $36
         47        FETCH_LIST_R                                     $38     $35, 1
         48        ASSIGN                                                   !3, $38
         49        FREE                                                     $35
         50        ECHO                                                     '%0AH%3A%0A'
         51        CONCAT                                           ~40     !2, '%0A'
         52        ECHO                                                     ~40
         53        ECHO                                                     !3
  153    54        ECHO                                                     'PILEEEEEE%0A'
  154    55        NEW                                              $41     'Sheet'
         56        SEND_VAL_EX                                              4
         57        SEND_VAL_EX                                              <array>
         58        DO_FCALL                                      0          
         59        ASSIGN                                                   !5, $41
         60        NEW                                              $44     'Sheet'
         61        SEND_VAL_EX                                              4
         62        SEND_VAL_EX                                              <array>
         63        DO_FCALL                                      0          
         64        ASSIGN                                                   !6, $44
  155    65        NEW                                              $47     'SheetPile'
         66        SEND_VAL_EX                                              4
         67        DO_FCALL                                      0          
         68        ASSIGN                                                   !7, $47
         69        INIT_METHOD_CALL                                         !7, 'add'
         70        SEND_VAR_EX                                              !5
         71        DO_FCALL                                      0          
         72        INIT_METHOD_CALL                                         !7, 'add'
         73        SEND_VAR_EX                                              !6
         74        DO_FCALL                                      0          
         75        ECHO                                                     !7
  156    76        NEW                                              $52     'Sheet'
         77        SEND_VAL_EX                                              2
         78        SEND_VAL_EX                                              <array>
         79        DO_FCALL                                      0          
         80        ASSIGN                                                   !8, $52
         81        NEW                                              $55     'Sheet'
         82        SEND_VAL_EX                                              2
         83        SEND_VAL_EX                                              <array>
         84        DO_FCALL                                      0          
         85        ASSIGN                                                   !9, $55
  157    86        NEW                                              $58     'SheetPile'
         87        SEND_VAL_EX                                              2
         88        DO_FCALL                                      0          
         89        ASSIGN                                                   !10, $58
         90        INIT_METHOD_CALL                                         !10, 'add'
         91        SEND_VAR_EX                                              !8
         92        DO_FCALL                                      0          
         93        INIT_METHOD_CALL                                         !10, 'add'
         94        SEND_VAR_EX                                              !9
         95        DO_FCALL                                      0          
         96        ECHO                                                     !10
  158    97        NEW                                              $63     'Sheet'
         98        SEND_VAL_EX                                              1
         99        SEND_VAL_EX                                              4
        100        DO_FCALL                                      0          
        101        ASSIGN                                                   !11, $63
        102        NEW                                              $66     'Sheet'
        103        SEND_VAL_EX                                              1
        104        SEND_VAL_EX                                              1
        105        DO_FCALL                                      0          
        106        ASSIGN                                                   !12, $66
  159   107        NEW                                              $69     'SheetPile'
        108        SEND_VAL_EX                                              1
        109        DO_FCALL                                      0          
        110        ASSIGN                                                   !13, $69
        111        INIT_METHOD_CALL                                         !13, 'add'
        112        SEND_VAR_EX                                              !11
        113        DO_FCALL                                      0          
        114        INIT_METHOD_CALL                                         !13, 'add'
        115        SEND_VAR_EX                                              !12
        116        DO_FCALL                                      0          
        117        ECHO                                                     !13
  160   118        ECHO                                                     'pilediv%0A'
  161   119        INIT_FCALL                                               'print_r'
        120        INIT_METHOD_CALL                                         !7, 'stackUp'
        121        DO_FCALL                                      0  $74     
        122        INIT_METHOD_CALL                                         $74, 'stackUp'
        123        DO_FCALL                                      0  $75     
        124        INIT_METHOD_CALL                                         $75, 'SingleSheetPile_To_Array'
        125        DO_FCALL                                      0  $76     
        126        SEND_VAR                                                 $76
        127        DO_ICALL                                                 
  162   128        INIT_FCALL                                               'print_r'
        129        INIT_FCALL                                               'verify_a4toa6'
        130        SEND_VAL                                                 8
        131        DO_FCALL                                      0  $78     
        132        SEND_VAR                                                 $78
        133        DO_ICALL                                                 
        134      > RETURN                                                   1

Function intdiv_1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/psb75
function name:  intdiv_1
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        MOD                                              ~2      !0, !1
          3        SUB                                              ~3      !0, ~2
          4        DIV                                              ~4      ~3, !1
          5      > RETURN                                                   ~4
    4     6*     > RETURN                                                   null

End of function intdiv_1

Function int_div:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/psb75
function name:  int_div
number of ops:  19
compiled vars:  !0 = $dividend, !1 = $divisor, !2 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        INIT_FCALL                                               'function_exists'
          3        SEND_VAL                                                 'intdiv'
          4        DO_ICALL                                         $3      
          5      > JMPZ                                                     $3, ->12
    8     6    >   INIT_FCALL                                               'intdiv'
          7        SEND_VAR                                                 !0
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $4      
         10        ASSIGN                                                   !2, $4
         11      > JMP                                                      ->17
   10    12    >   INIT_FCALL                                               'intdiv_1'
         13        SEND_VAR                                                 !0
         14        SEND_VAR                                                 !1
         15        DO_FCALL                                      0  $6      
         16        ASSIGN                                                   !2, $6
   11    17    > > RETURN                                                   !2
   12    18*     > RETURN                                                   null

End of function int_div

Function a4toa6:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 11
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 13
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 30, Position 2 = 11
Branch analysis from position: 30
Branch analysis from position: 11
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 13
Branch analysis from position: 27
Branch analysis from position: 13
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 13
Branch analysis from position: 27
Branch analysis from position: 13
filename:       /in/psb75
function name:  A4toA6
number of ops:  32
compiled vars:  !0 = $num_pages, !1 = $n, !2 = $arr, !3 = $pp, !4 = $i, !5 = $j, !6 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  119     0  E >   RECV                                             !0      
  120     1        INIT_FCALL                                               'int_div'
          2        SUB                                              ~7      !0, 1
          3        SEND_VAL                                                 ~7
          4        SEND_VAL                                                 4
          5        DO_FCALL                                      0  $8      
          6        ADD                                              ~9      1, $8
          7        ASSIGN                                                   !1, ~9
  122     8        ASSIGN                                                   !3, 1
  123     9        ASSIGN                                                   !4, 1
         10      > JMP                                                      ->28
  124    11    >   ASSIGN                                                   !5, 0
         12      > JMP                                                      ->25
  125    13    >   MUL                                              ~14     !5, !1
         14        ADD                                              ~15     !4, ~14
         15        ASSIGN                                                   !6, ~15
  126    16        IS_SMALLER                                               !0, !6
         17      > JMPZ                                                     ~19, ->20
         18    >   QM_ASSIGN                                        ~20     '+'
         19      > JMP                                                      ->21
         20    >   QM_ASSIGN                                        ~20     !6
         21    >   FETCH_DIM_W                                      $17     !2, !4
         22        ASSIGN_DIM                                               $17, !5
         23        OP_DATA                                                  ~20
  124    24        PRE_INC                                                  !5
         25    >   IS_SMALLER                                               !5, 4
         26      > JMPNZ                                                    ~22, ->13
  123    27    >   PRE_INC                                                  !4
         28    >   IS_SMALLER_OR_EQUAL                                      !4, !1
         29      > JMPNZ                                                    ~24, ->11
  129    30    > > RETURN                                                   !2
  130    31*     > RETURN                                                   null

End of function a4toa6

Function verify_a4toa6:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 20
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 20
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 30
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 30
Branch analysis from position: 35
Branch analysis from position: 30
Branch analysis from position: 20
filename:       /in/psb75
function name:  verify_A4toA6
number of ops:  40
compiled vars:  !0 = $num_pages, !1 = $arr, !2 = $pile, !3 = $val, !4 = $sheet4, !5 = $pages, !6 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  131     0  E >   RECV                                             !0      
  132     1        INIT_FCALL                                               'a4toa6'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $7      
          4        ASSIGN                                                   !1, $7
  133     5        NEW                                              $9      'SheetPile'
          6        SEND_VAL_EX                                              4
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $9
  134     9      > FE_RESET_R                                       $12     !1, ->20
         10    > > FE_FETCH_R                                               $12, !3, ->20
  135    11    >   NEW                                              $13     'Sheet'
         12        SEND_VAL_EX                                              4
         13        SEND_VAR_EX                                              !3
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !4, $13
  136    16        INIT_METHOD_CALL                                         !2, 'add'
         17        SEND_VAR_EX                                              !4
         18        DO_FCALL                                      0          
  134    19      > JMP                                                      ->10
         20    >   FE_FREE                                                  $12
  138    21        INIT_METHOD_CALL                                         !2, 'stackUp'
         22        DO_FCALL                                      0  $17     
         23        ASSIGN                                                   !2, $17
  139    24        INIT_METHOD_CALL                                         !2, 'stackUp'
         25        DO_FCALL                                      0  $19     
         26        ASSIGN                                                   !2, $19
  140    27        ASSIGN                                                   !5, <array>
  141    28        ASSIGN                                                   !6, 1
         29      > JMP                                                      ->33
  142    30    >   ASSIGN_DIM                                               !5
         31        OP_DATA                                                  !6
  141    32        PRE_INC                                                  !6
         33    >   IS_SMALLER_OR_EQUAL                                      !6, !0
         34      > JMPNZ                                                    ~25, ->30
  143    35    >   INIT_METHOD_CALL                                         !2, 'SingleSheetPile_To_Array'
         36        DO_FCALL                                      0  $26     
         37        IS_EQUAL                                         ~27     !5, $26
         38      > RETURN                                                   ~27
  144    39*     > RETURN                                                   null

End of function verify_a4toa6

Class Sheet:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 22
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 13, Position 2 = 19
Branch analysis from position: 13
2 jumps found. (Code = 78) Position 1 = 14, Position 2 = 19
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
Branch analysis from position: 22
2 jumps found. (Code = 46) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 32
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 27
Branch analysis from position: 10
filename:       /in/psb75
function name:  __construct
number of ops:  37
compiled vars:  !0 = $dim, !1 = $arg, !2 = $i, !3 = $elem
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   23     2        ASSIGN_OBJ                                               'size'
          3        OP_DATA                                                  !0
   24     4        TYPE_CHECK                                  128  ~5      !1
          5        BOOL                                             ~6      ~5
          6      > JMPZ_EX                                          ~6      ~6, ->10
          7    >   COUNT                                            ~7      !1
          8        IS_EQUAL                                         ~8      !0, ~7
          9        BOOL                                             ~6      ~8
         10    > > JMPZ                                                     ~6, ->22
   25    11    >   ASSIGN                                                   !2, 1
   26    12      > FE_RESET_R                                       $10     !1, ->19
         13    > > FE_FETCH_R                                               $10, !3, ->19
   27    14    >   POST_INC                                         ~12     !2
         15        FETCH_OBJ_W                                      $11     'sections'
         16        ASSIGN_DIM                                               $11, ~12
         17        OP_DATA                                                  !3
   26    18      > JMP                                                      ->13
         19    >   FE_FREE                                                  $10
   28    20      > RETURN                                                   null
         21*       JMP                                                      ->36
   31    22    >   TYPE_CHECK                                  128  ~14     !1
         23        BOOL_NOT                                         ~15     ~14
         24      > JMPZ_EX                                          ~15     ~15, ->27
         25    >   IS_EQUAL                                         ~16     !0, 1
         26        BOOL                                             ~15     ~16
         27    > > JMPZ                                                     ~15, ->32
   32    28    >   FETCH_OBJ_W                                      $17     'sections'
         29        ASSIGN_DIM                                               $17, 1
         30        OP_DATA                                                  !1
         31      > JMP                                                      ->36
   34    32    >   NEW                                              $19     'Exception'
         33        SEND_VAL_EX                                              'Incompatible+arguments'
         34        DO_FCALL                                      0          
         35      > THROW                                         0          $19
   36    36    > > RETURN                                                   null

End of function __construct

Function __tostring:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/psb75
function name:  __toString
number of ops:  14
compiled vars:  !0 = $ret, !1 = $val, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   ASSIGN                                                   !0, '-'
   39     1        FETCH_OBJ_R                                      ~4      'sections'
          2      > FE_RESET_R                                       $5      ~4, ->8
          3    > > FE_FETCH_R                                       ~6      $5, !1, ->8
          4    >   ASSIGN                                                   !2, ~6
   40     5        CAST                                          6  ~8      !1
          6        ASSIGN_OP                                     8          !0, ~8
   39     7      > JMP                                                      ->3
          8    >   FE_FREE                                                  $5
   41     9        CONCAT                                           ~10     !0, '-'
         10        VERIFY_RETURN_TYPE                                       ~10
         11      > RETURN                                                   ~10
   42    12*       VERIFY_RETURN_TYPE                                       
         13*     > RETURN                                                   null

End of function __tostring

Function divide:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 5, Position 2 = 31
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
filename:       /in/psb75
function name:  divide
number of ops:  59
compiled vars:  !0 = $ret1, !1 = $ret2, !2 = $arr1, !3 = $arr2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   FETCH_OBJ_R                                      ~4      'size'
   48     1        CASE                                                     ~4, 4
          2      > JMPNZ                                                    ~5, ->6
   54     3    >   CASE                                                     ~4, 2
          4      > JMPNZ                                                    ~5, ->31
          5    > > JMP                                                      ->48
   49     6    >   FETCH_OBJ_R                                      ~6      'sections'
          7        FETCH_DIM_R                                      ~7      ~6, 1
          8        INIT_ARRAY                                       ~8      ~7
          9        FETCH_OBJ_R                                      ~9      'sections'
         10        FETCH_DIM_R                                      ~10     ~9, 3
         11        ADD_ARRAY_ELEMENT                                ~8      ~10
         12        ASSIGN                                                   !2, ~8
   50    13        NEW                                              $12     'Sheet'
         14        SEND_VAL_EX                                              2
         15        SEND_VAR_EX                                              !2
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !0, $12
   51    18        FETCH_OBJ_R                                      ~15     'sections'
         19        FETCH_DIM_R                                      ~16     ~15, 2
         20        INIT_ARRAY                                       ~17     ~16
         21        FETCH_OBJ_R                                      ~18     'sections'
         22        FETCH_DIM_R                                      ~19     ~18, 4
         23        ADD_ARRAY_ELEMENT                                ~17     ~19
         24        ASSIGN                                                   !3, ~17
   52    25        NEW        

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.96 ms | 1431 KiB | 23 Q