Posted by Kim Andrι Akerψ on 03/24/07 08:28
Mary Pegg wrote:
> There's got to be a better way:
> if (isset($c['s']['a1'])) echo $c['s']['a1']."<br>";
> if (isset($c['s']['a2'])) echo $c['s']['a2']."<br>";
> if (isset($c['s']['a3'])) echo $c['s']['a3']."<br>";
> if (isset($c['s']['a4'])) echo $c['s']['a4']."<br>";
> if (isset($c['s']['a5'])) echo $c['s']['a5']."<br>";
>
> but it's late and my brain is frazzled. Any ideas, oh PHP gurus?
Perhaps like this?
foreach ($c['s'] as $item) {
echo $item."<br>";
}
If you want an extra check, you could also surround it with this:
if (isset($c['s']) and is_array($c['s'])) {
}
--
Kim AndrΓ© AkerΓΈ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
[Back to original message]
|