I have a string as
$line = \"Name=johnGender=M\";
How to make a string called $name that will have a value stored as joh
Suppose we dont know the length of the name. Say,
$line = "Name=SaifUrRehmanGender=M";
Use strpos() to get the index of "Gender"
The strpos() function finds the position of the first occurrence of a string inside another string.
For your case:
$name = substr($line,5,strpos($line,"Gender")-5); will do :)
Output: SaifUrRehman