3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dgs_clean( $str ) { return trim(preg_replace('/\s\s+/', ' ', $str)); } function dgs_strlist($array, $keys) { $out = ''; $_k = (is_array($keys))?$keys:array($keys); var_dump($_k); echo "\n"; foreach ($_k as $k => $v) { $key = (is_int($k))?$v:$k; echo "$key\n"; if (isset($array[$key]) && !empty($array[$key])) $out .= ' '.((is_int($k))?$array[$key]:$v); } return dgs_clean($out); } $test = array('name' => 'myInput', 'value' => '123', 'type' => 'text', '_prepend' => '@', 'class' => 'component inline'); echo dgs_strlist($test, array('class', '_prepend' => 'input-prepend'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sId5I
function name:  (null)
number of ops:  7
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, <array>
   16     1        INIT_FCALL                                               'dgs_strlist'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <array>
          4        DO_FCALL                                      0  $2      
          5        ECHO                                                     $2
          6      > RETURN                                                   1

Function dgs_clean:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/sId5I
function name:  dgs_clean
number of ops:  11
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'trim'
          2        INIT_FCALL                                               'preg_replace'
          3        SEND_VAL                                                 '%2F%5Cs%5Cs%2B%2F'
          4        SEND_VAL                                                 '+'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $1      
          7        SEND_VAR                                                 $1
          8        DO_ICALL                                         $2      
          9      > RETURN                                                   $2
    4    10*     > RETURN                                                   null

End of function dgs_clean

Function dgs_strlist:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 41
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 41
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 46) Position 1 = 28, Position 2 = 31
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 40
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 37
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 40
Branch analysis from position: 31
Branch analysis from position: 21
2 jumps found. (Code = 46) Position 1 = 28, Position 2 = 31
Branch analysis from position: 28
Branch analysis from position: 31
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 41
Branch analysis from position: 15
Branch analysis from position: 41
filename:       /in/sId5I
function name:  dgs_strlist
number of ops:  47
compiled vars:  !0 = $array, !1 = $keys, !2 = $out, !3 = $_k, !4 = $v, !5 = $k, !6 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        ASSIGN                                                   !2, ''
          3        TYPE_CHECK                                  128          !1
          4      > JMPZ                                                     ~8, ->7
          5    >   QM_ASSIGN                                        ~9      !1
          6      > JMP                                                      ->9
          7    >   INIT_ARRAY                                       ~10     !1
          8        QM_ASSIGN                                        ~9      ~10
          9    >   ASSIGN                                                   !3, ~9
    7    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !3
         12        DO_ICALL                                                 
    8    13        ECHO                                                     '%0A'
         14      > FE_RESET_R                                       $13     !3, ->41
         15    > > FE_FETCH_R                                       ~14     $13, !4, ->41
         16    >   ASSIGN                                                   !5, ~14
    9    17        TYPE_CHECK                                   16          !5
         18      > JMPZ                                                     ~16, ->21
         19    >   QM_ASSIGN                                        ~17     !4
         20      > JMP                                                      ->22
         21    >   QM_ASSIGN                                        ~17     !5
         22    >   ASSIGN                                                   !6, ~17
   10    23        NOP                                                      
         24        FAST_CONCAT                                      ~19     !6, '%0A'
         25        ECHO                                                     ~19
   11    26        ISSET_ISEMPTY_DIM_OBJ                         0  ~20     !0, !6
         27      > JMPZ_EX                                          ~20     ~20, ->31
         28    >   ISSET_ISEMPTY_DIM_OBJ                         1  ~21     !0, !6
         29        BOOL_NOT                                         ~22     ~21
         30        BOOL                                             ~20     ~22
         31    > > JMPZ                                                     ~20, ->40
         32    >   TYPE_CHECK                                   16          !5
         33      > JMPZ                                                     ~23, ->37
         34    >   FETCH_DIM_R                                      ~24     !0, !6
         35        QM_ASSIGN                                        ~25     ~24
         36      > JMP                                                      ->38
         37    >   QM_ASSIGN                                        ~25     !4
         38    >   CONCAT                                           ~26     '+', ~25
         39        ASSIGN_OP                                     8          !2, ~26
    8    40    > > JMP                                                      ->15
         41    >   FE_FREE                                                  $13
   13    42        INIT_FCALL                                               'dgs_clean'
         43        SEND_VAR                                                 !2
         44        DO_FCALL                                      0  $28     
         45      > RETURN                                                   $28
   14    46*     > RETURN                                                   null

End of function dgs_strlist

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.25 ms | 1403 KiB | 21 Q