Hello all i am new to php kindly tell me ho to ptint only array values. I have the output as-
Array ( [
Which Note is not Shuddha in Raag Durga?
] => stdClass Object ( [questiontext] =>
Which Note is not Shuddha in Raag Durga?
) [
Pa
] => stdClass Object ( [questiontext] =>
Pa
) [
Re
] => stdClass Object ( [questiontext] =>
Re
) [
All Nodes Are Shuddha
] => stdClass Object ( [questiontext] =>
All Nodes Are Shuddha
) [
Dha
] => stdClass Object ( [questiontext] =>
Dha
) )
I want only questionn and its option kindly help
How to print array values
Moderator: General Moderators
Re: How to print array values
You do have the questions and answers already. What do you want to do with them?
Re: How to print array values
i want only text values not in array format....i want to get specific values but not in array format or better i say i want to fetch array values
Re: How to print array values
and also hoe to get individual values from this structutre.....
array ( '
All Nodes Are Shuddha
' => stdClass::__set_state(array( 'answer' => '
All Nodes Are Shuddha
', )), )
array ( '
All Nodes Are Shuddha
' => stdClass::__set_state(array( 'answer' => '
All Nodes Are Shuddha
', )), )
Re: How to print array values
They've already been fetched. Next you do something with the values. Probably involves a foreach loop. If it doesn't then you actually have to be, you know, specific about what you want to do with the data.Ankush wrote:i want only text values not in array format....i want to get specific values but not in array format or better i say i want to fetch array values
That's a string you got from var_export()ing something. Instead of doing that, deal with the actual variable you tried to export.Ankush wrote:and also hoe to get individual values from this structutre.....
array ( '
All Nodes Are Shuddha
' => stdClass::__set_state(array( 'answer' => '
All Nodes Are Shuddha
', )), )
-
CoursesWeb
- Forum Newbie
- Posts: 18
- Joined: Mon Dec 09, 2013 10:52 am
Re: How to print array values
Hi
Tryy traverse the array with foreach(). Something like this for your array.
Tryy traverse the array with foreach(). Something like this for your array.
Code: Select all
foreach($your_array as $key => $val) {
echo $val->questiontext;
}