Hello,
I hate these preg_matches but this seems easy one
I have the following string
$string = "name=john;
[email protected]; phone=4234234;";
I want to preg_match this $string to take our the keys name, email, phone and their values john,
[email protected] and 4234234;
What is special about this is that the string may not contain the character ; or it may have spaces between key and value. For example all the possible combinations are the followings.
$string = "name=john;
[email protected]; phone=4234234;"; #primary
$string = "name=john;
[email protected]; phone=4234234"; #it doesnt have for example the ; at the last one
$string = "name =john; email
[email protected]; phone =4234234;"; #it has a space before the char =
$string = "name = john; email =
[email protected]; phone = 4234234;"; #it has a space after and before the =
$string = "name= john;email=
[email protected];phone=4234234;"; #it can be like that, no spaces everywhere
I hope you understand me.
Thank you