What's this ruby? Care to send the list a URL so we can go have a
look for ourselves?

Gfunk         -          http://www.gfunk007.com/

I sense much beer in you. Beer leads to intoxication, intoxication to
hangovers, and hangovers to... suffering.


----- Original Message -----
From: "Lux" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Monday, February 05, 2001 10:51 AM
Subject: Re: [PHP] Is this a missing feature?


> > But the feature is useless :)
>
> Here, I removed the reference, so we can stop fussing over it (it wasn't
the
> question to begin with), and here's an example of a potential use for this
> (a stupid example, but still...).  I'm not weighing out the benefits of
> references, I'm striving to achieve the cleanest and most elegant code I
> can, because the larger the project, the more code you have to read, and
> the uglier it can get.
>
> That's where a language like Ruby excels.  There's less syntactical crap,
> it's very easy to read, and it's caused me to consider switching to eRuby
> (like mod_perl, allows <% ruby this, ruby that %> in your html) because it
> is structurally easier and more geared towards larger projects.
>
> (that last statement will probably get me murdered on a PHP list)
>
> But honestly, the only problem is finding a host running eRuby that I
don't
> have to maintain myself.  I'm lazy, after all.
>
> later,
>
> lux
>
> <?php
>
>     function a ($hash, $text = "") {
>        $attr_text = "";
>        while (list ($k, $v) = each ($hash)) {
>           $attr_text .= " $k=\"$v\"";
>        }
>        return "<a$attr_text>$text</a>";
>     }
>
>     function img ($hash) {
>        $attr_text = "";
>        while (list ($k, $v) = each ($hash)) {
>          $attr_text .= " $k=\"$v\"";
>        }
>        return "<img$attr_text />";
>     }
>
>     // works this way
>
>     $attrs = array (
>        "href" => "http://www.google.com/",
>        "target" => "_blank"
>     );
>     echo a ($attrs, "Visit Google!");
>
>     echo "\n\n";
>
>     // also this way (thanx teodor!)
>
>     echo a ($attrs = array (
>          "href" => "http://www.google.com/",
>          "target" => "_blank"
>     ), "Visit Google!");
>
>     // ideally, i'd like to say this though...
>     // echo a (["href" => "http://www.google.com/", "target" =>
> "_blank"], "Visit Google!");
>
>     // what also doesn't work
>     // echo a (array("href" => "http://www.google.com/", "target" =>
> "_blank"), "Visit Google!");
>
>     echo "\n\n";
>
>     // another example
>
>     echo a ($attrs = array ("href" => "http://www.google.com/"),
>          img ($attrs = 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' => 'Visit
> Google!', 'border' => '0'])
>     );
>
>     */
>
> ?>
>
> --
>
> John Luxford
> Simian Systems
>
> w: www.simian.ca
> e: [EMAIL PROTECTED]
> p: 204.946.5955
>
> --
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to