Re: Boolean type forced on string assignment inside if statement

From: Date: Thu, 03 Jan 2013 16:13:36 +0000
Subject: Re: Boolean type forced on string assignment inside if statement
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-320004@lists.php.net to get a copy of this message
On Thu, 3 Jan 2013, Jim Giner wrote:
The only time I use a single '=' symbol in an if statement is when I forget to use two of them! Must be my old school, old languages habits but this style of programming reminds me of the days when we used to pack empty spaces in assembler code with constants or byte-size vars in order to save memory back when memory was the most precious resource one had.
The only time I'd consider doing it is if the next thing I was going to do would be check to see if the assignment itself worked. for example: if (file_handle = fopen("foo", "r")) {
    ...
} Geoff.

« previous php.general (#320004) next »