3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); $arr = ['one' => 'hello', 'two' => 'world' ]; [$hello, $world] = $arr; echo "$hello $world\n"; echo "2nd try:\n"; ['two' => $hello, 'one' => $world] = $arr; echo "$hello $world\n"; // Hi!
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZMr0p
function name:  (null)
number of ops:  25
compiled vars:  !0 = $arr, !1 = $hello, !2 = $world
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
    7     1        QM_ASSIGN                                        ~4      !0
          2        FETCH_LIST_R                                     $5      ~4, 0
          3        ASSIGN                                                   !1, $5
          4        FETCH_LIST_R                                     $7      ~4, 1
          5        ASSIGN                                                   !2, $7
          6        FREE                                                     ~4
    9     7        ROPE_INIT                                     4  ~10     !1
          8        ROPE_ADD                                      1  ~10     ~10, '+'
          9        ROPE_ADD                                      2  ~10     ~10, !2
         10        ROPE_END                                      3  ~9      ~10, '%0A'
         11        ECHO                                                     ~9
   11    12        ECHO                                                     '2nd+try%3A%0A'
   13    13        QM_ASSIGN                                        ~12     !0
         14        FETCH_LIST_R                                     $13     ~12, 'two'
         15        ASSIGN                                                   !1, $13
         16        FETCH_LIST_R                                     $15     ~12, 'one'
         17        ASSIGN                                                   !2, $15
         18        FREE                                                     ~12
   15    19        ROPE_INIT                                     4  ~18     !1
         20        ROPE_ADD                                      1  ~18     ~18, '+'
         21        ROPE_ADD                                      2  ~18     ~18, !2
         22        ROPE_END                                      3  ~17     ~18, '%0A'
         23        ECHO                                                     ~17
   18    24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.05 ms | 1385 KiB | 13 Q