Re: Function return
| From: | Dan Shirah | Date: | Fri, 02 Nov 2007 14:53:50 +0000 |
| Subject: | Re: Function return | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263976@lists.php.net to get a copy of this message | ||
Ah, okay. So I could probably simplfy it more by trimming it from the start
like this??
$due_date = trim($_POST['due_date']);
On 11/2/07, Nathan Nobbe <quickshiftin@gmail.com> wrote:
>
> On 11/2/07, Dan Shirah <mrsquash2@gmail.com> wrote:
> >
> > Okay, so instead I should probably use:
> >
> > if($due_date != "")
> > $insert2.=", due_date='$due_date'";
> >
> > Instead of using empty()
> >
>
>
> using emtpy is fine; just store the results of trim in a temporary variable:
>
> $trimmed = trim($due_date);
> if(!empty($trimmed)) {
>
> $insert2 .= ", due_date='$due_date'";
>
> }
>
> -nathan
>
>
>
>