Case :
Hi, Stackoverflow community.
Actually i have looping (while) inside while. That's what i call sub while. I want to return some value from while to sub while same, but it looks like, value can't be read in a sub while.
Experiment :
- Fetch code working normally. All fine, except this $x;
- There is no other error found, but global $x, can't be printed inside sub while
I try to use global function to declare the while function value. Still, global function can't be read in sub while. The code is barely like this :
while (fetch){
$x = value; // multi value, like A, B, C, D, E for example
global $x;
echo $x; // echo print still ok
while (fetch){
echo "<select>". // i use select attribute in this case, it's plus a (.) dot
// so code inside this sub while actually working but $x can't be printed
echo $x; // not print anything
echo "<option" . (($x==$throw[0]) ? 'selected="selected"': '') ."value=".$throw[0].">".$throw[0]."</option>'";
// i use this option attribute, and want $x to be inside the option attribute basically, because it needs to be compared
"</select>";
} // end sub while
} // end while
Desired Output :
I want value in $x return as is it, like in while loop. Because the multi value inside $x will be compared with $throw[0] which has value shown properly while $x value isn't even shown.
FYI, $x contain several value like for example : A, B, C, D, E.
Do you have any idea why this is happen ? What should i do or modify ?
Thank You Stackoverflow Community.