Aureole Posted December 9, 2007 Share Posted December 9, 2007 Is it not possible to return more than one thing from a function? I tried... return $var, $anothervar; and I get an unexpected "," error. If it's not possible then instead is it possible to do... well, I have this: <?php foreach($player_stats as $prop => $val) { $formatprop = '<p class="content"><strong>'.htmlentities($prop, ENT_QUOTES).'</strong></p>'; $formatval = '<p class="content">'.htmlentities($val, ENT_QUOTES).'<p>'; ?> <tr> <td width="30%" class="black_td"><?php echo $formatprop; ?></td> <td width="70%" class="gray_td"><?php echo $formatval; ?></td> </tr> <?php } ?> ...but I want the foreach to ignore $player_stats['length'], to skip it. Ignore it then go through the rest. Maybe like... <?php foreach($player_stats as $prop => $val) { if($prop !== 'length') { $formatprop = '<p class="content"><strong>'.htmlentities($prop, ENT_QUOTES).'</strong></p>'; $formatval = '<p class="content">'.htmlentities($val, ENT_QUOTES).'<p>'; // Etc. } } ...or is there a better way? Quote Link to comment Share on other sites More sharing options...
JacobYaYa Posted December 9, 2007 Share Posted December 9, 2007 Return an array containing both your values. Quote Link to comment Share on other sites More sharing options...
Aureole Posted December 9, 2007 Author Share Posted December 9, 2007 Then I'd be returning two arrays within an array... That would be confusing. It's ok anyhow I found a way around my problem. But anyway... I'm guessing it's not possible to return more than one variable then, right? Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.