Re: Problem with Adding info into an array

From: Date: Tue, 22 Jul 2003 10:06:37 +0000
Subject: Re: Problem with Adding info into an array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-156199@lists.php.net to get a copy of this message
Phillip Blancher wrote:
if($array[0]=="") { $array[0]="0"; } else { } if($array[1]=="") { $array[1]="0"; } else { } if($array[2]=="") { $array[2]="0"; } else { } if($array[3]=="") { $array[3]="0"; } else { } if($array[4]=="") { $array[4]="0"; } else { } if($array[5]=="") { $array[5]="0"; } else { } if($array[6]=="") { $array[6]="0"; } else { } But this just made the values of the array become blank. Any suggestions? Try
if(!$array[0]) $array[0]='0';

« previous php.general (#156199) next »