3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dgs_clean( $str ) { return trim(preg_replace('/\s\s+/', ' ', $str)); } function dgs_Alist($array, $keys='', $format='%2$s', $separator=' ') { // return a string list of defined array[key]'s, values may be substituted via key definition if(empty($array)) return array(); $out = ''; $_k = (empty($keys)?array_keys($array):((is_array($keys))?$keys:array($keys))); foreach ($_k as $k => $v) { $key = (is_int($k))?$v:$k; if (isset($array[$key]) && !empty($array[$key])) $out .= ((!empty($out))?$separator:'').vsprintf($format,array($key, ((is_int($k))?$array[$key]:$v))); } return (($format=='%2$s') && ($separator==' '))?dgs_clean($out):$out; } $test = array('name' => 'myInput', 'value' => '123', 'type' => 'text', '_prepend' => '@', 'class' => 'component inline'); echo dgs_Alist($test,'','%1$s: %2$s',', ');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aJoJU
function name:  (null)
number of ops:  9
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, <array>
   16     1        INIT_FCALL                                               'dgs_alist'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 ''
          4        SEND_VAL                                                 '%251%24s%3A+%252%24s'
          5        SEND_VAL                                                 '%2C+'
          6        DO_FCALL                                      0  $2      
          7        ECHO                                                     $2
          8      > RETURN                                                   1

Function dgs_clean:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aJoJU
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_alist:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 59
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 59
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 30
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 46) Position 1 = 34, Position 2 = 37
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 58
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 41, Position 2 = 43
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 52
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 52
Branch analysis from position: 49
Branch analysis from position: 52
Branch analysis from position: 58
Branch analysis from position: 37
Branch analysis from position: 30
2 jumps found. (Code = 46) Position 1 = 34, Position 2 = 37
Branch analysis from position: 34
Branch analysis from position: 37
Branch analysis from position: 59
2 jumps found. (Code = 46) Position 1 = 62, Position 2 = 64
Branch analysis from position: 62
2 jumps found. (Code = 43) Position 1 = 65, Position 2 = 70
Branch analysis from position: 65
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 70
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 64
Branch analysis from position: 59
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 59
Branch analysis from position: 24
Branch analysis from position: 59
Branch analysis from position: 19
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 59
Branch analysis from position: 24
Branch analysis from position: 59
filename:       /in/aJoJU
function name:  dgs_Alist
number of ops:  73
compiled vars:  !0 = $array, !1 = $keys, !2 = $format, !3 = $separator, !4 = $out, !5 = $_k, !6 = $v, !7 = $k, !8 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      ''
          2        RECV_INIT                                        !2      '%252%24s'
          3        RECV_INIT                                        !3      '+'
    7     4        ISSET_ISEMPTY_CV                                         !0
          5      > JMPZ                                                     ~9, ->7
          6    > > RETURN                                                   <array>
    8     7    >   ASSIGN                                                   !4, ''
          8        ISSET_ISEMPTY_CV                                         !1
          9      > JMPZ                                                     ~11, ->15
         10    >   INIT_FCALL                                               'array_keys'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $12     
         13        QM_ASSIGN                                        ~13     $12
         14      > JMP                                                      ->22
         15    >   TYPE_CHECK                                  128          !1
         16      > JMPZ                                                     ~14, ->19
         17    >   QM_ASSIGN                                        ~15     !1
         18      > JMP                                                      ->21
         19    >   INIT_ARRAY                                       ~16     !1
         20        QM_ASSIGN                                        ~15     ~16
         21    >   QM_ASSIGN                                        ~13     ~15
         22    >   ASSIGN                                                   !5, ~13
    9    23      > FE_RESET_R                                       $18     !5, ->59
         24    > > FE_FETCH_R                                       ~19     $18, !6, ->59
         25    >   ASSIGN                                                   !7, ~19
   10    26        TYPE_CHECK                                   16          !7
         27      > JMPZ                                                     ~21, ->30
         28    >   QM_ASSIGN                                        ~22     !6
         29      > JMP                                                      ->31
         30    >   QM_ASSIGN                                        ~22     !7
         31    >   ASSIGN                                                   !8, ~22
   11    32        ISSET_ISEMPTY_DIM_OBJ                         0  ~24     !0, !8
         33      > JMPZ_EX                                          ~24     ~24, ->37
         34    >   ISSET_ISEMPTY_DIM_OBJ                         1  ~25     !0, !8
         35        BOOL_NOT                                         ~26     ~25
         36        BOOL                                             ~24     ~26
         37    > > JMPZ                                                     ~24, ->58
         38    >   ISSET_ISEMPTY_CV                                 ~27     !4
         39        BOOL_NOT                                         ~28     ~27
         40      > JMPZ                                                     ~28, ->43
         41    >   QM_ASSIGN                                        ~29     !3
         42      > JMP                                                      ->44
         43    >   QM_ASSIGN                                        ~29     ''
         44    >   INIT_FCALL                                               'vsprintf'
         45        SEND_VAR                                                 !2
         46        INIT_ARRAY                                       ~30     !8
         47        TYPE_CHECK                                   16          !7
         48      > JMPZ                                                     ~31, ->52
         49    >   FETCH_DIM_R                                      ~32     !0, !8
         50        QM_ASSIGN                                        ~33     ~32
         51      > JMP                                                      ->53
         52    >   QM_ASSIGN                                        ~33     !6
         53    >   ADD_ARRAY_ELEMENT                                ~30     ~33
         54        SEND_VAL                                                 ~30
         55        DO_ICALL                                         $34     
         56        CONCAT                                           ~35     ~29, $34
         57        ASSIGN_OP                                     8          !4, ~35
    9    58    > > JMP                                                      ->24
         59    >   FE_FREE                                                  $18
   13    60        IS_EQUAL                                         ~37     !2, '%252%24s'
         61      > JMPZ_EX                                          ~37     ~37, ->64
         62    >   IS_EQUAL                                         ~38     !3, '+'
         63        BOOL                                             ~37     ~38
         64    > > JMPZ                                                     ~37, ->70
         65    >   INIT_FCALL                                               'dgs_clean'
         66        SEND_VAR                                                 !4
         67        DO_FCALL                                      0  $39     
         68        QM_ASSIGN                                        ~40     $39
         69      > JMP                                                      ->71
         70    >   QM_ASSIGN                                        ~40     !4
         71    > > RETURN                                                   ~40
   14    72*     > RETURN                                                   null

End of function dgs_alist

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.85 ms | 1407 KiB | 23 Q