3v4l.org

run code in 300+ PHP versions simultaneously
<?php $adjectives = [ "Abaft", "Abandoned", "Abased", "Abashed", "Abasic", "Abbatial", "Abdicable", "Abdicant", "Abdicative", "Abdominal", "Abdominous", "Abducent", "Aberrant", "Aberrational", ]; $animals = [ "aardvark", "aardwolf", "abalone", "abyssiniancat", "abyssiniangroundhornbill", "acaciarat", "achillestang", "acornbarnacle", "acornweevil", "acornwoodpecker", "acouchi", "adamsstaghornedbeetle", "addax", "adder", ]; class AnimalIDs{ protected $adjectives = null; protected $animals = null; public function __construct($adjectives, $animals){ $this->adjectives = $adjectives; $this->animals = $animals; } public function get($adjectivesNum = 1,$format = 'dash'){ $result = ''; $delim = ''; for($n = 0; $n < $adjectivesNum; $n++){ if($format === 'dash'){ $result .= $delim . $this->adjectives[rand(0,count($this->adjectives) - 1)]; $delim = '-'; } } $result .= $delim . $this->animals[rand(0,count($this->animals) - 1)]; return $result; } } $a = new AnimalIDs($adjectives, $animals); echo $a->get()."\n"; echo $a->get(2)."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tHVsJ
function name:  (null)
number of ops:  17
compiled vars:  !0 = $adjectives, !1 = $animals, !2 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   20     1        ASSIGN                                                   !1, <array>
   61     2        NEW                                              $5      'AnimalIDs'
          3        SEND_VAR_EX                                              !0
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !2, $5
   62     7        INIT_METHOD_CALL                                         !2, 'get'
          8        DO_FCALL                                      0  $8      
          9        CONCAT                                           ~9      $8, '%0A'
         10        ECHO                                                     ~9
   63    11        INIT_METHOD_CALL                                         !2, 'get'
         12        SEND_VAL_EX                                              2
         13        DO_FCALL                                      0  $10     
         14        CONCAT                                           ~11     $10, '%0A'
         15        ECHO                                                     ~11
         16      > RETURN                                                   1

Class AnimalIDs:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tHVsJ
function name:  __construct
number of ops:  7
compiled vars:  !0 = $adjectives, !1 = $animals
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   42     2        ASSIGN_OBJ                                               'adjectives'
          3        OP_DATA                                                  !0
   43     4        ASSIGN_OBJ                                               'animals'
          5        OP_DATA                                                  !1
   44     6      > RETURN                                                   null

End of function __construct

Function get:
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 = 6
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 6
Branch analysis from position: 23
Branch analysis from position: 6
Branch analysis from position: 20
filename:       /in/tHVsJ
function name:  get
number of ops:  36
compiled vars:  !0 = $adjectivesNum, !1 = $format, !2 = $result, !3 = $delim, !4 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   RECV_INIT                                        !0      1
          1        RECV_INIT                                        !1      'dash'
   47     2        ASSIGN                                                   !2, ''
   48     3        ASSIGN                                                   !3, ''
   49     4        ASSIGN                                                   !4, 0
          5      > JMP                                                      ->21
   50     6    >   IS_IDENTICAL                                             !1, 'dash'
          7      > JMPZ                                                     ~8, ->20
   51     8    >   INIT_FCALL                                               'rand'
          9        SEND_VAL                                                 0
         10        FETCH_OBJ_R                                      ~10     'adjectives'
         11        COUNT                                            ~11     ~10
         12        SUB                                              ~12     ~11, 1
         13        SEND_VAL                                                 ~12
         14        DO_ICALL                                         $13     
         15        FETCH_OBJ_R                                      ~9      'adjectives'
         16        FETCH_DIM_R                                      ~14     ~9, $13
         17        CONCAT                                           ~15     !3, ~14
         18        ASSIGN_OP                                     8          !2, ~15
   52    19        ASSIGN                                                   !3, '-'
   49    20    >   PRE_INC                                                  !4
         21    >   IS_SMALLER                                               !4, !0
         22      > JMPNZ                                                    ~19, ->6
   56    23    >   INIT_FCALL                                               'rand'
         24        SEND_VAL                                                 0
         25        FETCH_OBJ_R                                      ~21     'animals'
         26        COUNT                                            ~22     ~21
         27        SUB                                              ~23     ~22, 1
         28        SEND_VAL                                                 ~23
         29        DO_ICALL                                         $24     
         30        FETCH_OBJ_R                                      ~20     'animals'
         31        FETCH_DIM_R                                      ~25     ~20, $24
         32        CONCAT                                           ~26     !3, ~25
         33        ASSIGN_OP                                     8          !2, ~26
   57    34      > RETURN                                                   !2
   58    35*     > RETURN                                                   null

End of function get

End of class AnimalIDs.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.2 ms | 1400 KiB | 15 Q