3v4l.org

run code in 300+ PHP versions simultaneously
<?php function penjumlahan($data_angka) { $hasil = 0; foreach($data_angka as $index => $value) { $hasil = $hasil + $value; } return $hasil; } $kumpulan_angka = array(3,5,7,8,9); $hasil = penjumlahan($kumpulan_angka); echo $hasil; function tukarData($data_a, $data_b) { $data_c = $data_a; $data_a = $data_b; $data_b = $data_c; return array($data_a, $data_b); } $data_a = "Teh"; $data_b = "Susu"; $hasil_tukar = tukarData($data_a, $data_b); $hasil_tukar[0] = $data_a; $hasil_tukar[1] = $data_b; echo $hasil_tukar; echo $data_a; echo $data_b;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MUv9C
function name:  (null)
number of ops:  21
compiled vars:  !0 = $kumpulan_angka, !1 = $hasil, !2 = $data_a, !3 = $data_b, !4 = $hasil_tukar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   12     1        INIT_FCALL                                               'penjumlahan'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $6      
          4        ASSIGN                                                   !1, $6
   13     5        ECHO                                                     !1
   23     6        ASSIGN                                                   !2, 'Teh'
   24     7        ASSIGN                                                   !3, 'Susu'
   26     8        INIT_FCALL                                               'tukardata'
          9        SEND_VAR                                                 !2
         10        SEND_VAR                                                 !3
         11        DO_FCALL                                      0  $10     
         12        ASSIGN                                                   !4, $10
   27    13        ASSIGN_DIM                                               !4, 0
         14        OP_DATA                                                  !2
   28    15        ASSIGN_DIM                                               !4, 1
         16        OP_DATA                                                  !3
   29    17        ECHO                                                     !4
   30    18        ECHO                                                     !2
   31    19        ECHO                                                     !3
         20      > RETURN                                                   1

Function penjumlahan:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 8
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
filename:       /in/MUv9C
function name:  penjumlahan
number of ops:  11
compiled vars:  !0 = $data_angka, !1 = $hasil, !2 = $value, !3 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, 0
    5     2      > FE_RESET_R                                       $5      !0, ->8
          3    > > FE_FETCH_R                                       ~6      $5, !2, ->8
          4    >   ASSIGN                                                   !3, ~6
    6     5        ADD                                              ~8      !1, !2
          6        ASSIGN                                                   !1, ~8
    5     7      > JMP                                                      ->3
          8    >   FE_FREE                                                  $5
    8     9      > RETURN                                                   !1
    9    10*     > RETURN                                                   null

End of function penjumlahan

Function tukardata:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MUv9C
function name:  tukarData
number of ops:  9
compiled vars:  !0 = $data_a, !1 = $data_b, !2 = $data_c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2        ASSIGN                                                   !2, !0
   17     3        ASSIGN                                                   !0, !1
   18     4        ASSIGN                                                   !1, !2
   20     5        INIT_ARRAY                                       ~6      !0
          6        ADD_ARRAY_ELEMENT                                ~6      !1
          7      > RETURN                                                   ~6
   21     8*     > RETURN                                                   null

End of function tukardata

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.06 ms | 1403 KiB | 15 Q