On Friday 12 April 2002 02:50, Kevin Stone wrote:
> On the other hand the Inline Method is clean. You can see at a glance
> where each block begins ends. But it is not compact. It spreads the code
> out over many lines. I recommend this method for modern programmers coding
> on large screens. Besides that I think it's just a better way to code.
> More whitespace = less confusion = faster debugs.
>
> /**** INLINE METHOD *****/
> foreach ($mylist as $key => $val)
> {
> if ($key == $list_num)
> {
> for ($i=0; $i<count($key); $i++)
> {
> record_list($key[$i]);
> }
> }
> elseif ($key == $skip_val)
> {
> continue;
> }
> else
> {
> echo "INVALID ENTRY: "$key ." at ". $val . "\n";
> }
> }
> /************************/
I prefer this style because I know exactly where my if statement ends,
especially if you have a humungous nested if-elseif-else construct.
foreach ($mylist as $key => $val) {
if ($key == $list_num) {
for ($i=0; $i<count($key); $i++) {
record_list($key[$i]);
}}
elseif ($key == $skip_val) {
continue; }
else {
echo "INVALID ENTRY: "$key ." at ". $val . "\n";
}
}
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
Weiler's Law:
Nothing is impossible for the man who doesn't have to do it himself.
*/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php