Hi, How would I extract specific data from a string? For example: <? $string= "Name: Bob<br> Age: 5 Years Old<br> Likes: None<br>"; ?> PHP: That as an example, how would I get "5 Years Old" on its own when I specified "Age:" in the PHP code? For example, if I specified to the script to pick out "Age:", it would out put: "5 Years Old". Any help is GREATLY appreciated!
could just use something like explode $a = explode("Name: ",$string); $b = explode("<br>",$a[0]); echo $b[0]; //this should return bob bit dirty however should work
Or you could use substr() to provide the range of characters to return. Quicker and more efficient than explode and regex.