selenin Posted June 9, 2010 Share Posted June 9, 2010 Hello, arrays are killing me, my code: $keywords = $movie->keywords(); foreach ($keywords as $tag) { var_dump($tag); } then I get this string(6) "Rabbit" string(5) "Queen" string(4) "Card" string(7) "Reality" string(17) "Parallel Universe" but I would need the result out of the loop, but there I have only Parallel Universe, when I make this: $keywords = $movie->keywords(); var_dump($keywords); I get this: array(5) { [0]=> string(6) "Rabbit" [1]=> string(5) "Queen" [2]=> string(4) "Card" [3]=> string(7) "Reality" [4]=> string(17) "Parallel Universe" } What I could need is the second one but only with one key, then I could make a foreach in the template, is this possible like array(5) { [0]=> string(6) "Rabbit" => string(5) "Queen" => string(4) "Card" => string(7) "Reality" => string(17) "Parallel Universe" } Maybe I'm completely on the wrong way Link to comment https://forums.phpfreaks.com/topic/204328-array-problem-again/ Share on other sites More sharing options...
Andy-H Posted June 9, 2010 Share Posted June 9, 2010 I don't understand your question, you mean like this: ?? $keywords = $movie->keywords(); $keywords = implode(', ', $keywords); echo $keywords; implode Link to comment https://forums.phpfreaks.com/topic/204328-array-problem-again/#findComment-1070113 Share on other sites More sharing options...
selenin Posted June 9, 2010 Author Share Posted June 9, 2010 , thanks a lot, I'm still not able to do it the easy way Link to comment https://forums.phpfreaks.com/topic/204328-array-problem-again/#findComment-1070116 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.