Re: Handling Code Continuation

From: Date: Sat, 26 Jun 2004 04:29:01 +0000
Subject: Re: Handling Code Continuation
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-189103@lists.php.net to get a copy of this message
* Thus wrote gohaku: > Hi everyone, > I would like to know how to handle code breaks or code blocks > that takes up more than two lines. you just might start a war of the gods here.... > For readability, I would like to know if there is something like the > following: > function input($type,$size,$name,$value) > { > return "<input type=\"$type\" size=\"$size\" > value=\"$value\" >>> > name=\"$name\">"; > } In general practice, and depending on how much html you're outputing: function input($type,$size,$name,$value) { <?php <input type="<php echo $type?>" size="<?php echo $size?>" value="<?php echo $value?>" name="<?php echo $name?>> } But on the other hand a different approach: $field = array( 'type' => $type, 'size' => $size, 'value' => $value, 'name' => $type, 'id' => $id, /* forgot this one :) */ ); echo '<input >'; foreach($field as $name => $value ) { echo "$name=\"$value\" } echo '>'; Curt -- First, let me assure you that this is not one of those shady pyramid schemes you've been hearing about. No, sir. Our model is the trapezoid!

« previous php.general (#189103) next »