3v4l.org

run code in 300+ PHP versions simultaneously
<html> <body> <?php $images = array( array('img' => 'image1.jpg', 'url' => 'http://example1.com', 'div' => 'class="d1"'), array('img' => 'image2.jpg', 'url' => 'http://example2.com', 'div' => 'class="d2"'), array('img' => 'image3.jpg', 'url' => 'http://example3.com', 'div' => 'class="d3"'), array('img' => 'image4.jpg', 'url' => 'http://example4.com', 'div' => 'class="d4"'), array('img' => 'image5.jpg', 'url' => 'http://example5.com', 'div' => 'class="d5"'), array('img' => 'image6.jpg', 'url' => 'http://example6.com', 'div' => 'class="d6"') ); // Selects 3 random array values and returns the key for each value $randomkeys = array_rand($images, 3); // Here we loop through the given index keys from the $images array. // For each key we will then get the value from $images with the index $key foreach ($randomkeys as $key) { // I end with PHP_EOL (End of line) so the source code will look a bit prettier. echo '<div class="1">' . PHP_EOL . '<a href="' . $images[$key]['url'] . '">' . PHP_EOL . '<div ' . $images[$key]['div'] . '>' . PHP_EOL . '<img src="' . $images[$key]['img'] . '">' . PHP_EOL . '</div>' . PHP_EOL . '</a></div>' . PHP_EOL; } ?> </body> </html>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 32
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 32
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/OAc6l
function name:  (null)
number of ops:  35
compiled vars:  !0 = $images, !1 = $randomkeys, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     '%3Chtml%3E%0A%3Cbody%3E%0A'
    4     1        ASSIGN                                                   !0, <array>
   14     2        INIT_FCALL                                               'array_rand'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 3
          5        DO_ICALL                                         $4      
          6        ASSIGN                                                   !1, $4
   18     7      > FE_RESET_R                                       $6      !1, ->32
          8    > > FE_FETCH_R                                               $6, !2, ->32
   20     9    >   FETCH_DIM_R                                      ~7      !0, !2
         10        FETCH_DIM_R                                      ~8      ~7, 'url'
         11        CONCAT                                           ~9      '%3Cdiv+class%3D%221%22%3E%0A%3Ca+href%3D%22', ~8
         12        CONCAT                                           ~10     ~9, '%22%3E'
         13        CONCAT                                           ~11     ~10, '%0A'
         14        CONCAT                                           ~12     ~11, '%3Cdiv+'
         15        FETCH_DIM_R                                      ~13     !0, !2
         16        FETCH_DIM_R                                      ~14     ~13, 'div'
         17        CONCAT                                           ~15     ~12, ~14
         18        CONCAT                                           ~16     ~15, '%3E'
         19        CONCAT                                           ~17     ~16, '%0A'
         20        CONCAT                                           ~18     ~17, '%3Cimg+src%3D%22'
         21        FETCH_DIM_R                                      ~19     !0, !2
         22        FETCH_DIM_R                                      ~20     ~19, 'img'
         23        CONCAT                                           ~21     ~18, ~20
         24        CONCAT                                           ~22     ~21, '%22%3E'
         25        CONCAT                                           ~23     ~22, '%0A'
         26        CONCAT                                           ~24     ~23, '%3C%2Fdiv%3E'
         27        CONCAT                                           ~25     ~24, '%0A'
         28        CONCAT                                           ~26     ~25, '%3C%2Fa%3E%3C%2Fdiv%3E'
         29        CONCAT                                           ~27     ~26, '%0A'
         30        ECHO                                                     ~27
   18    31      > JMP                                                      ->8
         32    >   FE_FREE                                                  $6
   23    33        ECHO                                                     '%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   24    34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.56 ms | 998 KiB | 14 Q