Re: php programming style
| From: | Tularis | Date: | Thu, 21 Nov 2002 18:07:44 +0000 |
| Subject: | Re: php programming style | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-125450@lists.php.net to get a copy of this message | ||
why wouldn't it be??
it's clean code as long as you can read it without having to do much trouble, and you have written it the shortest way possible with still enough extra stuff around to make other ppl understand it...
so, I would say -> yeah, it's clean :)
- Tularis
Beau Hartshorne wrote:
Hi, I'm curious if it's bad coding style for a function to return a value on success, or simply "false" on fail. Here's what I mean: <?php function foo($number) { if (is_numeric($number)) { return $number . ' is a number.'; } else { return false; } } if ($string = foo(1)) { echo $string; } else { echo 'error'; } ?>
Is this ok? Thank you, Beau