temp-learn
temp-learn

Reputation: 537

Unable to explode from PHP StdClass Object

i am unable to explode an STDclass variable i have values in the object some what like mentioned below, but when i take the dump i get

I have stdClass Object ( [page_path] => 14-45-55 ). When i try to explode this

$pages = $database->executeObjectList("SELECT page_path FROM tblwebpages WHERE page_id=" . $_GET['id']);
$explodedString = explode('-', $pages->page_path);
print_r($explodedString);  
exit;

on taking dump of ($explodedString) i get

Array ( [0] => )

can i know what am i doing wrong if?

Upvotes: 0

Views: 3211

Answers (1)

gen_Eric
gen_Eric

Reputation: 227310

Your $pages, according to your comment, is actually an array (containing an object).

You need to do this instead:

$explodedString = explode('-', $pages[0]->page_path);

Upvotes: 4

Related Questions