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



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to