Consider that i have the string,
$string = 'tag2 display="users" limit="5"';
Using the preg_match_all function, i need to get the output
Required o/p
Array
(
    [0] => Array
        (
            [0] => tag2
            [1] => tag2
            [2] => 
        )
    [1] => Array
        (
            [0] => display="users"
            [1] => display
            [2] => users
        )
    [2] => Array
        (
            [0] => limit="5"
            [1] => limit
            [2] => 5
        )
)
I tried using this pattern '/([^=\s]+)="([^"]+)"/' but it is not recognizing the parameter with no value (in this case tag2) Instead it gives the output
What I am getting
Array
(
    [0] => Array
        (
            [0] => display="users"
            [1] => display
            [2] => users
        )
    [1] => Array
        (
            [0] => limit="5"
            [1] => limit
            [2] => 5
        )
)
What will be the pattern for getting the required output ?
EDIT 1: I also need to get the attributes which are not wrapped with quotes ex: attr=val. Sorry for not mentioning before.
 
     
     
    