3v4l.org

run code in 300+ PHP versions simultaneously
<?php function AttrFromString($string) { preg_match_all('/(\S+)=["\']?((?:.(?!["\']?\s+(?:\S+)=|[>"\']))+.)["\']?|(\S+)/', $string, $matches); $newlist = array(); foreach($matches[0] as $yes) { if (strpos($yes, "=")!==false) { $as = explode('=', $yes); } array_push($newlist, array($as[0]. $as[1])); } var_dump($newlist); } AttrFromString("test=hallo tes2=\"doei\" test3='lol' no-pe ja test='niks'");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AkhDm
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'attrfromstring'
          1        SEND_VAL                                                 'test%3Dhallo+tes2%3D%22doei%22+test3%3D%27lol%27+no-pe+ja+test%3D%27niks%27'
          2        DO_FCALL                                      0          
          3      > RETURN                                                   1

Function attrfromstring:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 30
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 30
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 21
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/AkhDm
function name:  AttrFromString
number of ops:  35
compiled vars:  !0 = $string, !1 = $matches, !2 = $newlist, !3 = $yes, !4 = $as
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%2F%28%5CS%2B%29%3D%5B%22%27%5D%3F%28%28%3F%3A.%28%3F%21%5B%22%27%5D%3F%5Cs%2B%28%3F%3A%5CS%2B%29%3D%7C%5B%3E%22%27%5D%29%29%2B.%29%5B%22%27%5D%3F%7C%28%5CS%2B%29%2F'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
    4     6        ASSIGN                                                   !2, <array>
    5     7        FETCH_DIM_R                                      ~7      !1, 0
          8      > FE_RESET_R                                       $8      ~7, ->30
          9    > > FE_FETCH_R                                               $8, !3, ->30
    6    10    >   INIT_FCALL                                               'strpos'
         11        SEND_VAR                                                 !3
         12        SEND_VAL                                                 '%3D'
         13        DO_ICALL                                         $9      
         14        TYPE_CHECK                                  1018          $9
         15      > JMPZ                                                     ~10, ->21
    7    16    >   INIT_FCALL                                               'explode'
         17        SEND_VAL                                                 '%3D'
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                         $11     
         20        ASSIGN                                                   !4, $11
    9    21    >   INIT_FCALL                                               'array_push'
         22        SEND_REF                                                 !2
         23        FETCH_DIM_R                                      ~13     !4, 0
         24        FETCH_DIM_R                                      ~14     !4, 1
         25        CONCAT                                           ~15     ~13, ~14
         26        INIT_ARRAY                                       ~16     ~15
         27        SEND_VAL                                                 ~16
         28        DO_ICALL                                                 
    5    29      > JMP                                                      ->9
         30    >   FE_FREE                                                  $8
   11    31        INIT_FCALL                                               'var_dump'
         32        SEND_VAR                                                 !2
         33        DO_ICALL                                                 
   12    34      > RETURN                                                   null

End of function attrfromstring

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.8 ms | 1403 KiB | 24 Q