Re: Probably very easy to do, but for some reason...
- From: arkascha <no_spam@xxxxxxxxxxx>
- Date: Wed, 30 Jul 2008 14:32:46 +0200
Paul F. Johnson wrote:
$ex = explode("," $v);
foreach ($ex as $e)
{
if ($e != "0")
$newtext .= " : " . $foo[$e];
}
The problem is that $e here is not being interpreted how I'd expect (I'd
assume it to be a number). Do I need to cast $e as an int or is there
something I'm missing?
$e will by of type string, since $ex is an array of strings, since it is the
result of an explode() of a string.
- either do an explicit typecast in case you are really sure, you will
always have numerical values in there (check it...)
- or rely on php to make an implicit typecast which _might_ work, but then
again which _might_ make problems and lead to unexpected results if you
have mixed values as keys in your array $foo.
arkascha
.
- References:
- Probably very easy to do, but for some reason...
- From: Paul F. Johnson
- Probably very easy to do, but for some reason...
- Prev by Date: Re: Should a class directly reference $_SESSION?
- Next by Date: Re: Session handling, login across all subdomains
- Previous by thread: Probably very easy to do, but for some reason...
- Next by thread: Probably very easy to do, but for some reason...
- Index(es):
Relevant Pages
|