3v4l.org

run code in 500+ PHP versions simultaneously
<?php // declared in controller... $data = [ 'a' => -1.5, 'b' => false, 'c' => null, 'd' => 'stringy "string" thing', 'e' => range(3,10), 'f' => "0", 'g' => (object)['food' => 'bard'], 'h' => "not used", ]; // the CodeIgniter effect... extract($data); // in your view... $portToJS = ['a', 'b', 'c', 'd', 'e', 'f', 'g']; echo "\n<script>\nlet "; foreach ($portToJS as $i => $variable) { echo (!$i ? '' : ",\n\t") , "{$variable} = " , json_encode(${$variable}); } echo ";\n</script>";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 37
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 37
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
filename:       /in/SjaDP
function name:  (null)
number of ops:  40
compiled vars:  !0 = $data, !1 = $portToJS, !2 = $variable, !3 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   INIT_ARRAY                                           ~4      -1.5, 'a'
          1        ADD_ARRAY_ELEMENT                                    ~4      <false>, 'b'
          2        ADD_ARRAY_ELEMENT                                    ~4      null, 'c'
    7     3        ADD_ARRAY_ELEMENT                                    ~4      'stringy+%22string%22+thing', 'd'
    8     4        INIT_FCALL                                                   'range'
          5        SEND_VAL                                                     3
          6        SEND_VAL                                                     10
          7        DO_ICALL                                             $5      
          8        ADD_ARRAY_ELEMENT                                    ~4      $5, 'e'
    9     9        ADD_ARRAY_ELEMENT                                    ~4      '0', 'f'
    4    10        CAST                                              8  ~6      <array>
         11        ADD_ARRAY_ELEMENT                                    ~4      ~6, 'g'
   11    12        ADD_ARRAY_ELEMENT                                    ~4      'not+used', 'h'
    3    13        ASSIGN                                                       !0, ~4
   15    14        INIT_FCALL                                                   'extract'
         15        SEND_REF                                                     !0
         16        DO_ICALL                                                     
   18    17        ASSIGN                                                       !1, <array>
   20    18        ECHO                                                         '%0A%3Cscript%3E%0Alet+'
   21    19      > FE_RESET_R                                           $10     !1, ->37
         20    > > FE_FETCH_R                                           ~11     $10, !2, ->37
         21    >   ASSIGN                                                       !3, ~11
   22    22        BOOL_NOT                                             ~13     !3
         23      > JMPZ                                                         ~13, ->26
         24    >   QM_ASSIGN                                            ~14     ''
         25      > JMP                                                          ->27
         26    >   QM_ASSIGN                                            ~14     '%2C%0A%09'
         27    >   ECHO                                                         ~14
         28        NOP                                                          
         29        FAST_CONCAT                                          ~15     !2, '+%3D+'
         30        ECHO                                                         ~15
         31        INIT_FCALL                                                   'json_encode'
         32        FETCH_R                          local               ~16     !2
         33        SEND_VAL                                                     ~16
         34        DO_ICALL                                             $17     
         35        ECHO                                                         $17
   21    36      > JMP                                                          ->20
         37    >   FE_FREE                                                      $10
   24    38        ECHO                                                         '%3B%0A%3C%2Fscript%3E'
         39      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.9 ms | 3345 KiB | 16 Q