3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = "hello : 6\ngoodbye : 7\nfoo : bar\n"; $lines = explode("\n", trim($data)); $tuples = array_map( function($line) { $splitLine = array_map('trim', explode(':', $line)); return array( trim(substr($line, 0, strpos(':'))), trim(substr($line, strpos(':'))) ); }, $lines ); $output = array_combine( array_map(function($t) { return $t[0]; }, $tuples), array_map(function($t) { return $t[1]; }, $tuples) ); var_dump($output);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LdN5V
function name:  (null)
number of ops:  34
compiled vars:  !0 = $data, !1 = $lines, !2 = $tuples, !3 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'hello+%3A+6%0Agoodbye+%3A+7%0Afoo+%3A+bar%0A'
    5     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%0A'
          3        INIT_FCALL                                               'trim'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $5      
          6        SEND_VAR                                                 $5
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !1, $6
    7     9        INIT_FCALL                                               'array_map'
    8    10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FLdN5V%3A8%240'
   17    11        SEND_VAL                                                 ~8
   18    12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $9      
    7    14        ASSIGN                                                   !2, $9
   21    15        INIT_FCALL                                               'array_combine'
   22    16        INIT_FCALL                                               'array_map'
         17        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FLdN5V%3A22%241'
         18        SEND_VAL                                                 ~11
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $12     
         21        SEND_VAR                                                 $12
   23    22        INIT_FCALL                                               'array_map'
         23        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FLdN5V%3A23%242'
         24        SEND_VAL                                                 ~13
         25        SEND_VAR                                                 !2
         26        DO_ICALL                                         $14     
         27        SEND_VAR                                                 $14
         28        DO_ICALL                                         $15     
   21    29        ASSIGN                                                   !3, $15
   26    30        INIT_FCALL                                               'var_dump'
         31        SEND_VAR                                                 !3
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FLdN5V%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LdN5V
function name:  {closure}
number of ops:  35
compiled vars:  !0 = $line, !1 = $splitLine
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'array_map'
          2        SEND_VAL                                                 'trim'
          3        INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '%3A'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
          8        DO_ICALL                                         $3      
          9        ASSIGN                                                   !1, $3
   14    10        INIT_FCALL                                               'trim'
         11        INIT_FCALL                                               'substr'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 0
         14        INIT_FCALL                                               'strpos'
         15        SEND_VAL                                                 '%3A'
         16        DO_ICALL                                         $5      
         17        SEND_VAR                                                 $5
         18        DO_ICALL                                         $6      
         19        SEND_VAR                                                 $6
         20        DO_ICALL                                         $7      
         21        INIT_ARRAY                                       ~8      $7
   15    22        INIT_FCALL                                               'trim'
         23        INIT_FCALL                                               'substr'
         24        SEND_VAR                                                 !0
         25        INIT_FCALL                                               'strpos'
         26        SEND_VAL                                                 '%3A'
         27        DO_ICALL                                         $9      
         28        SEND_VAR                                                 $9
         29        DO_ICALL                                         $10     
         30        SEND_VAR                                                 $10
         31        DO_ICALL                                         $11     
         32        ADD_ARRAY_ELEMENT                                ~8      $11
         33      > RETURN                                                   ~8
   17    34*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FLdN5V%3A8%240

Function %00%7Bclosure%7D%2Fin%2FLdN5V%3A22%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LdN5V
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        FETCH_DIM_R                                      ~1      !0, 0
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FLdN5V%3A22%241

Function %00%7Bclosure%7D%2Fin%2FLdN5V%3A23%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LdN5V
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        FETCH_DIM_R                                      ~1      !0, 1
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FLdN5V%3A23%242

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.51 ms | 1404 KiB | 27 Q