Sorry if this is a newbie question. Lets say I have this string (the values name and server can change): Also I forgot to say that I know the length of 'something' .
$str='something-name:Jon,server:localhost'
Now I must pull the values: 'Jon' and 'localhost' and put them in variables.
What I am doing now:
if ((strpos($str, 'something')) !== false){
$par_name = strpos($str, 'name:');
if ($par_name !== false){
$name = substr($n, 20);
}
}
Now:
$name == 'Jon,server:localhost'
Instead I need to get only the name and the after the server substring.
$name == 'Jon'
$server == 'localhost'
I guess I have to find the exact value for the third parameter of substr. I dont know.
Thank you for your responses.