php programming style

From: Date: Thu, 21 Nov 2002 17:57:32 +0000
Subject: php programming style
Groups: php.general 
Request: Send a blank email to php-general+get-125446@lists.php.net to get a copy of this message
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

« previous php.general (#125446) next »