3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getBaconSentences($len) { $paragraph = ""; $words = array( "upper" => array("The", "A", "One", "Some", "Any"), "lower" => array("the", "a", "one", "some", "any"), "noun" => array("boy", "girl", "dog", "town", "car"), "verb" => array("drove", "jumped", "ran", "walked", "skipped"), "prep" => array("to", "from", "over", "under", "on"), "adj" => array('tiny', 'freezing', 'lazy','boiling','filthy') ); $structures = array( array('upper', 'noun', 'verb', 'prep', 'lower', 'noun'), array('upper', 'noun', 'verb', 'prep', 'lower', 'adj', 'noun') ); while($len--) { $sentence = array(); $randStructure = array_rand($structures); for($i=0; $i<count($structures[$randStructure]); $i++) { echo json_encode($randStructure); $word = ' ';//array_rand($words[$randStructure[$i]]); $sentence[] = $word ; } $paragraph .= implode(" ", $sentence) . '. '; } return $paragraph; } echo getBaconSentences(10);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/g3BHe
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   INIT_FCALL                                               'getbaconsentences'
          1        SEND_VAL                                                 10
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function getbaconsentences:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 5
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 12
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 5
Branch analysis from position: 32
Branch analysis from position: 5
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 12
Branch analysis from position: 24
Branch analysis from position: 12
filename:       /in/g3BHe
function name:  getBaconSentences
number of ops:  34
compiled vars:  !0 = $len, !1 = $paragraph, !2 = $words, !3 = $structures, !4 = $sentence, !5 = $randStructure, !6 = $i, !7 = $word
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, ''
    6     2        ASSIGN                                                   !2, <array>
   15     3        ASSIGN                                                   !3, <array>
   20     4      > JMP                                                      ->30
   21     5    >   ASSIGN                                                   !4, <array>
   22     6        INIT_FCALL                                               'array_rand'
          7        SEND_VAR                                                 !3
          8        DO_ICALL                                         $12     
          9        ASSIGN                                                   !5, $12
   23    10        ASSIGN                                                   !6, 0
         11      > JMP                                                      ->20
   27    12    >   INIT_FCALL                                               'json_encode'
         13        SEND_VAR                                                 !5
         14        DO_ICALL                                         $15     
         15        ECHO                                                     $15
   30    16        ASSIGN                                                   !7, '+'
   32    17        ASSIGN_DIM                                               !4
         18        OP_DATA                                                  !7
   23    19        PRE_INC                                                  !6
         20    >   FETCH_DIM_R                                      ~19     !3, !5
         21        COUNT                                            ~20     ~19
         22        IS_SMALLER                                               !6, ~20
         23      > JMPNZ                                                    ~21, ->12
   34    24    >   INIT_FCALL                                               'implode'
         25        SEND_VAL                                                 '+'
         26        SEND_VAR                                                 !4
         27        DO_ICALL                                         $22     
         28        CONCAT                                           ~23     $22, '.+'
         29        ASSIGN_OP                                     8          !1, ~23
   20    30    >   POST_DEC                                         ~25     !0
         31      > JMPNZ                                                    ~25, ->5
   36    32    > > RETURN                                                   !1
   37    33*     > RETURN                                                   null

End of function getbaconsentences

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.02 ms | 1403 KiB | 20 Q