3v4l.org

run code in 300+ PHP versions simultaneously
<?php $answers = '{"0":"2","1":"3"}'; $answers = json_decode($answers, true); $options = '{"opt1":"4 Billion","opt2":"5 Billion","opt3":"6 Billion","opt4":"7 Billion"}'; $options = json_decode($options, true); uasort($options, function ($a, $b) { return rand(-1, 1); }); foreach ($options as $key => $value) { echo $value; if (in_array(substr($key, -1), $answers)) { // correct options echo "<input type='checkbox' value='".substr($key, -1)."'>" . PHP_EOL; } else { // wrong options echo "<input type='checkbox' value='".substr($key, -1)."'>" . PHP_EOL; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 48
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 48
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 39
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
filename:       /in/SVeqH
function name:  (null)
number of ops:  50
compiled vars:  !0 = $answers, !1 = $options, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%7B%220%22%3A%222%22%2C%221%22%3A%223%22%7D'
    4     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !0, $5
    5     6        ASSIGN                                                   !1, '%7B%22opt1%22%3A%224+Billion%22%2C%22opt2%22%3A%225+Billion%22%2C%22opt3%22%3A%226+Billion%22%2C%22opt4%22%3A%227+Billion%22%7D'
    6     7        INIT_FCALL                                               'json_decode'
          8        SEND_VAR                                                 !1
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $8      
         11        ASSIGN                                                   !1, $8
    7    12        INIT_FCALL                                               'uasort'
         13        SEND_REF                                                 !1
         14        DECLARE_LAMBDA_FUNCTION                          ~10     [0]
    9    15        SEND_VAL                                                 ~10
    7    16        DO_ICALL                                                 
   10    17      > FE_RESET_R                                       $12     !1, ->48
         18    > > FE_FETCH_R                                       ~13     $12, !2, ->48
         19    >   ASSIGN                                                   !3, ~13
   11    20        ECHO                                                     !2
   12    21        INIT_FCALL                                               'in_array'
         22        INIT_FCALL                                               'substr'
         23        SEND_VAR                                                 !3
         24        SEND_VAL                                                 -1
         25        DO_ICALL                                         $15     
         26        SEND_VAR                                                 $15
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                         $16     
         29      > JMPZ                                                     $16, ->39
   14    30    >   INIT_FCALL                                               'substr'
         31        SEND_VAR                                                 !3
         32        SEND_VAL                                                 -1
         33        DO_ICALL                                         $17     
         34        CONCAT                                           ~18     '%3Cinput+type%3D%27checkbox%27+value%3D%27', $17
         35        CONCAT                                           ~19     ~18, '%27%3E'
         36        CONCAT                                           ~20     ~19, '%0A'
         37        ECHO                                                     ~20
   12    38      > JMP                                                      ->47
   17    39    >   INIT_FCALL                                               'substr'
         40        SEND_VAR                                                 !3
         41        SEND_VAL                                                 -1
         42        DO_ICALL                                         $21     
         43        CONCAT                                           ~22     '%3Cinput+type%3D%27checkbox%27+value%3D%27', $21
         44        CONCAT                                           ~23     ~22, '%27%3E'
         45        CONCAT                                           ~24     ~23, '%0A'
         46        ECHO                                                     ~24
   10    47    > > JMP                                                      ->18
         48    >   FE_FREE                                                  $12
   19    49      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SVeqH
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        INIT_FCALL                                               'rand'
          3        SEND_VAL                                                 -1
          4        SEND_VAL                                                 1
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
    9     7*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.69 ms | 1020 KiB | 18 Q