Mailinglisten-Archive |
Reinhold Jordan wrote:
>>Ich weiß jetzt schon mal daß es so:
>>
>>$value[] = number_format($_SESSION[preis],0,"",".").if($_SESSION[vhb]){" VHB";}
>>
>>nicht funktioniert :-)
die Schlüssel für assoziative Arrays gehören in '
also: $_SESSION['preis']
> davon ab, daß es als Mehrzeiler kein Problem ist, also
>
> $value[] = number_format($_SESSION[preis],0,"",".");
> if($_SESSION[vhb]){
> $value[] .= " VHB";
> }
so würde es ja mal nachweislich nicht gehen
if ( ! empty($_SESSION['vhb']) )
{
$value[] = number_format( $_SESSION['preis'], 0, '', '.' ) . ' VHB';
}
else
{
$value[] = number_format( $_SESSION['preis'], 0, '', '.' );
}
> Geht das auch mit [bedingung]?[fals wahr]:[falls falsch]
> also so:
>
> $value[] = number_format($_SESSION[preis],0,"",".").($_SESSION[vhb])?" VHB":"";
und würde das nicht nur " VHB" liefern?
number_format($_SESSION[preis],0,"",".").($_SESSION[vhb])?" VHB":"";
( string ).( string )?" VHB":"";
( string )?" VHB":"";
$value[] = " VHB";
richtig wäre wohl:
$value[] =
number_format($_SESSION['preis'],0,'','.').($_SESSION['vhb']?' VHB':'');
wenn $_SESSION['vhb'] aber nicht gesetzt ist würde das ein
Warning/Notice? liefern
--
Sebastian Mendel
www.sebastianmendel.de www.warzonez.de www.tekkno4u.de www.nofetish.com
www.sf.net/projects/phpdatetime www.sf.net/projects/phptimesheet
php::bar PHP Wiki - Listenarchive