...

View Full Version : Resolved How to retrieve/get a part of string? HELP!



QueenZ
08-30-2009, 05:55 PM
Hello
So i need... from this..

http://www.youtube.com/watch?v=6xdp6OM02w4&feature=related

to get this..

6xdp6OM02w4

How can i do this?

kbluhm
08-30-2009, 05:57 PM
http://www.php.net/parse_url
http://www.php.net/parse_str


$url = 'http://www.youtube.com/watch?v=6xdp6OM02w4&feature=related';

$query = parse_url( $url, PHP_URL_QUERY );

parse_str( $query, $query );

echo $query['v']; // 6xdp6OM02w4

QueenZ
08-30-2009, 06:01 PM
Thank you kbluhm! That works great!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum