3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* This script generates a series of HTML tables with cells in different colours. It is an utterly useless way to generate images on-the-fly. It shows how comfortable PHP can be compared to raw HTML. This script is 5KB long compared to over 14MB (!) of HTML output. If you like this script, I would be most grateful if you could visit http://p2p.info.pl/eng/index.php and click a Google ad ;) */ $letter["a"]=array(array(0,1,1,1,0), array(1,0,0,0,1), array(1,0,0,0,1), array(1,1,1,1,1), array(1,0,0,0,1)); $letter["b"]=array(array(1,1,1,1,0), array(1,0,0,0,1), array(1,1,1,1,0), array(1,0,0,0,1), array(1,1,1,1,0)); $letter["d"]=array(array(1,1,1,1,0), array(1,0,0,0,1), array(1,0,0,0,1), array(1,0,0,0,1), array(1,1,1,1,0)); $letter["e"]=array(array(1,1,1,1,1), array(1,0,0,0,0), array(1,1,1,1,0), array(1,0,0,0,0), array(1,1,1,1,1)); $letter["f"]=array(array(1,1,1,1,1), array(1,0,0,0,0), array(1,1,1,1,0), array(1,0,0,0,0), array(1,0,0,0,0)); $letter["g"]=array(array(0,1,1,1,1), array(1,0,0,0,0), array(1,0,1,1,1), array(1,0,0,0,1), array(0,1,1,1,0)); $letter["h"]=array(array(1,0,0,0,1), array(1,0,0,0,1), array(1,1,1,1,1), array(1,0,0,0,1), array(1,0,0,0,1)); $letter["i"]=array(array(0,1,1,1,0), array(0,0,1,0,0), array(0,0,1,0,0), array(0,0,1,0,0), array(0,1,1,1,0)); $letter["k"]=array(array(1,0,0,0,1), array(1,0,0,1,0), array(1,1,1,0,0), array(1,0,0,1,0), array(1,0,0,0,1)); $letter["l"]=array(array(1,0,0,0,0), array(1,0,0,0,0), array(1,0,0,0,0), array(1,0,0,0,0), array(1,1,1,1,1)); $letter["m"]=array(array(1,0,0,0,1), array(1,1,0,1,1), array(1,0,1,0,1), array(1,0,0,0,1), array(1,0,0,0,1)); $letter["n"]=array(array(1,0,0,0,1), array(1,1,0,0,1), array(1,0,1,0,1), array(1,0,0,1,1), array(1,0,0,0,1)); $letter["o"]=array(array(0,1,1,1,0), array(1,0,0,0,1), array(1,0,0,0,1), array(1,0,0,0,1), array(0,1,1,1,0)); $letter["p"]=array(array(1,1,1,1,0), array(1,0,0,0,1), array(1,0,0,0,1), array(1,1,1,1,0), array(1,0,0,0,0)); $letter["r"]=array(array(1,1,1,1,0), array(1,0,0,0,1), array(1,0,0,0,1), array(1,1,1,1,0), array(1,0,0,0,1)); $letter["s"]=array(array(0,1,1,1,1), array(1,0,0,0,0), array(0,1,1,1,0), array(0,0,0,0,1), array(1,1,1,1,0)); $letter["t"]=array(array(1,1,1,1,1), array(0,0,1,0,0), array(0,0,1,0,0), array(0,0,1,0,0), array(0,0,1,0,0)); $letter["u"]=array(array(1,0,0,0,1), array(1,0,0,0,1), array(1,0,0,0,1), array(1,0,0,0,1), array(0,1,1,1,0)); $letter["w"]=array(array(1,0,0,0,1), array(1,0,0,0,1), array(1,0,1,0,1), array(1,1,0,1,1), array(1,0,0,0,1)); $letter["y"]=array(array(1,0,0,0,1), array(0,1,0,1,0), array(0,0,1,0,0), array(0,0,1,0,0), array(0,0,1,0,0)); $letter["0"]=array(array(0,0,1,0,0), array(0,1,0,1,0), array(0,1,0,1,0), array(0,1,0,1,0), array(0,0,1,0,0)); $letter["1"]=array(array(0,0,1,0,0), array(0,1,1,0,0), array(0,0,1,0,0), array(0,0,1,0,0), array(0,0,1,0,0)); $letter["2"]=array(array(0,1,1,1,0), array(1,0,0,1,1), array(0,0,1,0,0), array(0,1,0,0,0), array(1,1,1,1,1)); $letter["3"]=array(array(1,1,1,1,0), array(0,0,0,0,1), array(0,1,1,1,0), array(0,0,0,0,1), array(1,1,1,1,0)); $letter["4"]=array(array(1,0,0,0,1), array(1,0,0,0,1), array(1,0,0,0,1), array(1,1,1,1,1), array(0,0,0,0,1)); $letter["5"]=array(array(1,1,1,1,1), array(1,0,0,0,0), array(1,1,1,1,0), array(0,0,0,0,1), array(1,1,1,1,0)); $letter["6"]=array(array(0,1,1,1,1), array(1,0,0,0,0), array(1,1,1,1,0), array(1,0,0,0,1), array(0,1,1,1,0)); $letter["7"]=array(array(1,1,1,1,1), array(0,0,0,1,0), array(0,0,1,0,0), array(0,1,0,0,0), array(1,0,0,0,0)); $letter["8"]=array(array(0,1,1,1,0), array(1,0,0,0,1), array(0,1,1,1,0), array(1,0,0,0,1), array(0,1,1,1,0)); $letter["9"]=array(array(0,1,1,1,0), array(1,0,0,0,1), array(0,1,1,1,1), array(0,0,0,0,1), array(0,1,1,1,0)); $letter[","]=array(array(0,0,0,0,0), array(0,0,0,0,0), array(0,0,0,0,0), array(0,1,0,0,0), array(1,0,0,0,0)); $letter["."]=array(array(0,0,0,0,0), array(0,0,0,0,0), array(0,0,0,0,0), array(1,1,0,0,0), array(1,1,0,0,0)); function one_line($what_in_it){ global $letter; echo "<table cellspacing=\"0\">"; for ($y=0; $y<5; $y++){ echo "<tr>"; for ($i=0; $i<strlen($what_in_it); $i++){ for ($x=0; $x<5; $x++){ if ($letter[$what_in_it[$i]][$y][$x]==1) $colour="#000000"; else $colour="#ffffff"; echo "<td style=\"background-color:$colour\">"; echo "</td>"; } echo "<td style=\"background-color:#ffffff\"></td>"; } echo "</tr>"; } echo "<tr><td></td></tr>"; echo "</table>"; } for ($i=99; $i>0; $i--){ $i==1 ? $s="" : $s="s"; $i==1 ? $no="no more" : $no=$i-1; one_line("$i bottle$s of beer on the wall, $i bottle$s of beer."); one_line("take one down and pass it around, $no bottles of beer on the wall."); one_line(" "); } one_line("no more bottles of beer on the wall, no more bottles of beer."); one_line("go to the store and buy some more, 99 bottles of beer on the wall."); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 104
Branch analysis from position: 104
2 jumps found. (Code = 44) Position 1 = 106, Position 2 = 66
Branch analysis from position: 106
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 66
2 jumps found. (Code = 43) Position 1 = 68, Position 2 = 71
Branch analysis from position: 68
1 jumps found. (Code = 42) Position 1 = 73
Branch analysis from position: 73
2 jumps found. (Code = 43) Position 1 = 76, Position 2 = 79
Branch analysis from position: 76
1 jumps found. (Code = 42) Position 1 = 82
Branch analysis from position: 82
2 jumps found. (Code = 44) Position 1 = 106, Position 2 = 66
Branch analysis from position: 106
Branch analysis from position: 66
Branch analysis from position: 79
2 jumps found. (Code = 44) Position 1 = 106, Position 2 = 66
Branch analysis from position: 106
Branch analysis from position: 66
Branch analysis from position: 71
2 jumps found. (Code = 43) Position 1 = 76, Position 2 = 79
Branch analysis from position: 76
Branch analysis from position: 79
filename:       /in/k1nh3
function name:  (null)
number of ops:  113
compiled vars:  !0 = $letter, !1 = $i, !2 = $s, !3 = $no
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN_DIM                                               !0, 'a'
          1        OP_DATA                                                  <array>
   19     2        ASSIGN_DIM                                               !0, 'b'
          3        OP_DATA                                                  <array>
   24     4        ASSIGN_DIM                                               !0, 'd'
          5        OP_DATA                                                  <array>
   29     6        ASSIGN_DIM                                               !0, 'e'
          7        OP_DATA                                                  <array>
   34     8        ASSIGN_DIM                                               !0, 'f'
          9        OP_DATA                                                  <array>
   39    10        ASSIGN_DIM                                               !0, 'g'
         11        OP_DATA                                                  <array>
   44    12        ASSIGN_DIM                                               !0, 'h'
         13        OP_DATA                                                  <array>
   49    14        ASSIGN_DIM                                               !0, 'i'
         15        OP_DATA                                                  <array>
   54    16        ASSIGN_DIM                                               !0, 'k'
         17        OP_DATA                                                  <array>
   59    18        ASSIGN_DIM                                               !0, 'l'
         19        OP_DATA                                                  <array>
   64    20        ASSIGN_DIM                                               !0, 'm'
         21        OP_DATA                                                  <array>
   69    22        ASSIGN_DIM                                               !0, 'n'
         23        OP_DATA                                                  <array>
   74    24        ASSIGN_DIM                                               !0, 'o'
         25        OP_DATA                                                  <array>
   79    26        ASSIGN_DIM                                               !0, 'p'
         27        OP_DATA                                                  <array>
   84    28        ASSIGN_DIM                                               !0, 'r'
         29        OP_DATA                                                  <array>
   89    30        ASSIGN_DIM                                               !0, 's'
         31        OP_DATA                                                  <array>
   94    32        ASSIGN_DIM                                               !0, 't'
         33        OP_DATA                                                  <array>
   99    34        ASSIGN_DIM                                               !0, 'u'
         35        OP_DATA                                                  <array>
  104    36        ASSIGN_DIM                                               !0, 'w'
         37        OP_DATA                                                  <array>
  109    38        ASSIGN_DIM                                               !0, 'y'
         39        OP_DATA                                                  <array>
  114    40        ASSIGN_DIM                                               !0, 0
         41        OP_DATA                                                  <array>
  119    42        ASSIGN_DIM                                               !0, 1
         43        OP_DATA                                                  <array>
  124    44        ASSIGN_DIM                                               !0, 2
         45        OP_DATA                                                  <array>
  129    46        ASSIGN_DIM                                               !0, 3
         47        OP_DATA                                                  <array>
  134    48        ASSIGN_DIM                                               !0, 4
         49        OP_DATA                                                  <array>
  139    50        ASSIGN_DIM                                               !0, 5
         51        OP_DATA                                                  <array>
  144    52        ASSIGN_DIM                                               !0, 6
         53        OP_DATA                                                  <array>
  149    54        ASSIGN_DIM                                               !0, 7
         55        OP_DATA                                                  <array>
  154    56        ASSIGN_DIM                                               !0, 8
         57        OP_DATA                                                  <array>
  159    58        ASSIGN_DIM                                               !0, 9
         59        OP_DATA                                                  <array>
  164    60        ASSIGN_DIM                                               !0, '%2C'
         61        OP_DATA                                                  <array>
  169    62        ASSIGN_DIM                                               !0, '.'
         63        OP_DATA                                                  <array>
  197    64        ASSIGN                                                   !1, 99
         65      > JMP                                                      ->104
  198    66    >   IS_EQUAL                                                 !1, 1
         67      > JMPZ                                                     ~37, ->71
         68    >   ASSIGN                                           ~38     !2, ''
         69        QM_ASSIGN                                        ~39     ~38
         70      > JMP                                                      ->73
         71    >   ASSIGN                                           ~40     !2, 's'
         72        QM_ASSIGN                                        ~39     ~40
         73    >   FREE                                                     ~39
  199    74        IS_EQUAL                                                 !1, 1
         75      > JMPZ                                                     ~41, ->79
         76    >   ASSIGN                                           ~42     !3, 'no+more'
         77        QM_ASSIGN                                        ~43     ~42
         78      > JMP                                                      ->82
         79    >   SUB                                              ~44     !1, 1
         80        ASSIGN                                           ~45     !3, ~44
         81        QM_ASSIGN                                        ~43     ~45
         82    >   FREE                                                     ~43
  200    83        INIT_FCALL                                               'one_line'
         84        ROPE_INIT                                     8  ~47     !1
         85        ROPE_ADD                                      1  ~47     ~47, '+bottle'
         86        ROPE_ADD                                      2  ~47     ~47, !2
         87        ROPE_ADD                                      3  ~47     ~47, '+of+beer+on+the+wall%2C+'
         88        ROPE_ADD                                      4  ~47     ~47, !1
         89        ROPE_ADD                                      5  ~47     ~47, '+bottle'
         90        ROPE_ADD                                      6  ~47     ~47, !2
         91        ROPE_END                                      7  ~46     ~47, '+of+beer.'
         92        SEND_VAL                                                 ~46
         93        DO_FCALL                                      0          
  201    94        INIT_FCALL                                               'one_line'
         95        ROPE_INIT                                     3  ~53     'take+one+down+and+pass+it+around%2C+'
         96        ROPE_ADD                                      1  ~53     ~53, !3
         97        ROPE_END                                      2  ~52     ~53, '+bottles+of+beer+on+the+wall.'
         98        SEND_VAL                                                 ~52
         99        DO_FCALL                                      0          
  202   100        INIT_FCALL                                               'one_line'
        101        SEND_VAL                                                 '+'
        102        DO_FCALL                                      0          
  197   103        PRE_DEC                                                  !1
        104    >   IS_SMALLER                                               0, !1
        105      > JMPNZ                                                    ~58, ->66
  204   106    >   INIT_FCALL                                               'one_line'
        107        SEND_VAL                                                 'no+more+bottles+of+beer+on+the+wall%2C+no+more+bottles+of+beer.'
        108        DO_FCALL                                      0          
  205   109        INIT_FCALL                                               'one_line'
        110        SEND_VAL                                                 'go+to+the+store+and+buy+some+more%2C+99+bottles+of+beer+on+the+wall.'
        111        DO_FCALL                                      0          
  206   112      > RETURN                                                   1

Function one_line:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 5
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 8
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 5
Branch analysis from position: 36
Branch analysis from position: 5
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 10
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 8
Branch analysis from position: 32
Branch analysis from position: 8
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 10
Branch analysis from position: 27
Branch analysis from position: 10
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 10
Branch analysis from position: 27
Branch analysis from position: 10
filename:       /in/k1nh3
function name:  one_line
number of ops:  39
compiled vars:  !0 = $what_in_it, !1 = $letter, !2 = $y, !3 = $i, !4 = $x, !5 = $colour
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  175     0  E >   RECV                                             !0      
  176     1        BIND_GLOBAL                                              !1, 'letter'
  177     2        ECHO                                                     '%3Ctable+cellspacing%3D%220%22%3E'
  178     3        ASSIGN                                                   !2, 0
          4      > JMP                                                      ->34
  179     5    >   ECHO                                                     '%3Ctr%3E'
  180     6        ASSIGN                                                   !3, 0
          7      > JMP                                                      ->29
  181     8    >   ASSIGN                                                   !4, 0
          9      > JMP                                                      ->25
  182    10    >   FETCH_DIM_R                                      ~9      !0, !3
         11        FETCH_DIM_R                                      ~10     !1, ~9
         12        FETCH_DIM_R                                      ~11     ~10, !2
         13        FETCH_DIM_R                                      ~12     ~11, !4
         14        IS_EQUAL                                                 ~12, 1
         15      > JMPZ                                                     ~13, ->18
  183    16    >   ASSIGN                                                   !5, '%23000000'
         17      > JMP                                                      ->19
  185    18    >   ASSIGN                                                   !5, '%23ffffff'
  186    19    >   ROPE_INIT                                     3  ~17     '%3Ctd+style%3D%22background-color%3A'
         20        ROPE_ADD                                      1  ~17     ~17, !5
         21        ROPE_END                                      2  ~16     ~17, '%22%3E'
         22        ECHO                                                     ~16
  187    23        ECHO                                                     '%3C%2Ftd%3E'
  181    24        PRE_INC                                                  !4
         25    >   IS_SMALLER                                               !4, 5
         26      > JMPNZ                                                    ~20, ->10
  189    27    >   ECHO                                                     '%3Ctd+style%3D%22background-color%3A%23ffffff%22%3E%3C%2Ftd%3E'
  180    28        PRE_INC                                                  !3
         29    >   STRLEN                                           ~22     !0
         30        IS_SMALLER                                               !3, ~22
         31      > JMPNZ                                                    ~23, ->8
  191    32    >   ECHO                                                     '%3C%2Ftr%3E'
  178    33        PRE_INC                                                  !2
         34    >   IS_SMALLER                                               !2, 5
         35      > JMPNZ                                                    ~25, ->5
  193    36    >   ECHO                                                     '%3Ctr%3E%3Ctd%3E%3C%2Ftd%3E%3C%2Ftr%3E'
  194    37        ECHO                                                     '%3C%2Ftable%3E'
  195    38      > RETURN                                                   null

End of function one_line

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.23 ms | 1411 KiB | 18 Q