Page 1 of 1
numerical array to object
Posted: Wed Jun 13, 2007 7:43 pm
by afbase
Would anyone know how to do this, or is there some special php function that does this?
Posted: Wed Jun 13, 2007 8:01 pm
by volka
more details please.
Posted: Wed Jun 13, 2007 8:26 pm
by John Cartwright
Code: Select all
$array = array(1, 2, 3);
$obj = (object)$array;
typecasting is your friend, however as volka mentioned -- more details.
Posted: Wed Jun 13, 2007 9:27 pm
by afbase
well i have this array of URL's that i am going to CURL/regex the returned data. Trouble is when i loop through the array the website freaks out and gives me some wacky error "mdkID not found". I figure its a cookie problem or something, but if I do one link at at time, it works out just fine.
I think if i build an object from my numberical array, i should be fine. But i'm almost done with that part code!
Posted: Wed Jun 13, 2007 9:32 pm
by afbase
Jcart wrote:Code: Select all
$array = array(1, 2, 3);
$obj = (object)$array;
typecasting is your friend, however as volka mentioned -- more details.
is there a link from php.net for that (object) thing?
Posted: Wed Jun 13, 2007 9:35 pm
by John Cartwright
afbase wrote:is there a link from php.net for that (object) thing?
http://php.net/manual/en/language.types ... ggling.php
I would recommend you try fixing the problem at it's source instead of hacking up a bandaid solution.
Posted: Thu Jun 14, 2007 4:57 am
by volka
afbase wrote:I think if i build an object from my numberical array, i should be fine.
I don't see how "an object" will help you here.