3v4l.org

run code in 300+ PHP versions simultaneously
<?php // dummy data $i = 0; $_POST['value'][$i] = "sunshine"; //build an array in PHP $data = array( "Mo" => ($_POST['value'][$i] == "sunshine" ? 31 : null), "Di" => 31 ); //encode it as JSON reliably $json = json_encode($data); echo $json;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IRWQ3
function name:  (null)
number of ops:  22
compiled vars:  !0 = $i, !1 = $data, !2 = $json
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 0
    4     1        FETCH_W                      global              $4      '_POST'
          2        FETCH_DIM_W                                      $5      $4, 'value'
          3        ASSIGN_DIM                                               $5, !0
          4        OP_DATA                                                  'sunshine'
    8     5        FETCH_R                      global              ~7      '_POST'
          6        FETCH_DIM_R                                      ~8      ~7, 'value'
          7        FETCH_DIM_R                                      ~9      ~8, !0
          8        IS_EQUAL                                                 ~9, 'sunshine'
          9      > JMPZ                                                     ~10, ->12
         10    >   QM_ASSIGN                                        ~11     31
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~11     null
         13    >   INIT_ARRAY                                       ~12     ~11, 'Mo'
    9    14        ADD_ARRAY_ELEMENT                                ~12     31, 'Di'
    7    15        ASSIGN                                                   !1, ~12
   13    16        INIT_FCALL                                               'json_encode'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $14     
         19        ASSIGN                                                   !2, $14
   15    20        ECHO                                                     !2
   16    21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.23 ms | 1009 KiB | 14 Q