Re: Is this a missing feature?
| From: | Lux | Date: | Mon, 05 Feb 2001 00:33:23 +0000 |
| Subject: | Re: Is this a missing feature? | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-38165@lists.php.net to get a copy of this message | ||
I should check my version then... =O)
lux
Christian Reiniger wrote:
On Monday 05 February 2001 00:51, Lux wrote:-- John Luxford Simian Systems w: www.simian.ca e: lux@simian.ca p: 204.946.5955 --But the feature is useless :)function a ($hash, $text = "") {$attr_text = "";while (list ($k, $v) = each ($hash)) {$attr_text .= " $k=\"$v\"";}return "<a$attr_text>$text</a>";}// what also doesn't workWorks fine for me, sorry (php 4.0.4)// echo a (array("href" => "http://www.google.com/", "target" =>"_blank"), "Visit Google!");// another exampleecho a ($attrs = array ("href" => "http://www.google.com/"),img ($attrs = array ("src" =>"http://www.google.com/images/title_homepage4.gif", "alt" => "VisitGoogle!","border" => "0"))works, rewritten to echo a (array ("href" => "http://www.google.com/"), img (array ();"src" => "http://www.google.com/images/title_homepage4.gif","alt" => "Visit Google!","border" => "0")));/* now ideally, this could be written much more cleanly, perhaps...echo a(['href' => [http://www.google.com/'],img(['src' =>'http://www.google.com/images/title_homepage4.gif', 'alt' => 'VisitGoogle!', 'border' => '0']));So it basically boils down to "array (a => b)" versus "[a => b]" And I personally feel the array () notation is at least as nice as the [] one. Well, it's a matter of taste. But it certainly isn't harder to read, not detrimental on cleanness and elegance of the code.*/