Please help me out on this explode() function issue. I am getting unexpected results for the third scenario, what's the explanation?
EDIT: The value $page_string is actually from the database. This time I did the tests using var_dump instead of echo. The strings, How does php count them? How is "15&page" count 11?
var_dump($page_string);//string(11) "15&page"
1. Pop out ampersand ... fine.
$page_id_array = explode("&",$page_string);
$page_id = $page_id_array[0];
var_dump($page_id);
// string(2) "15"
2. Pop out number ... fine
$page_id_array = explode("15",$page_string);
$page_id = $page_id_array[1];
var_dump($page_id);
//string(9) "&blog"
3. Pop out '&page' ... why?
$page_id_array = explode("&page",$page_string);
$page_id = $page_id_array[0];
var_dump($page_id);
//string(11) "15&page"
var_dump($page_id_array[1]);
//NULL
EDIT: After answer and comments from jasonbar I did the test which confirms his answer:
$page_id_array = explode("&page",$page_string);
$page_id = $page_id_array[0];
var_dump($page_id);
//string(2) "15"