php-general Digest 29 Jun 2008 08:22:16 -0000 Issue 5540
Topics (messages 276099 through 276103):
Re: Inspiration for a Tombstone.
276099 by: Andrew Ballard
276100 by: Dotan Cohen
Another instance of shameless self promotion
276101 by: Richard Heyes
Adding new encodings to mbstring?
276102 by: Haluk AKIN
276103 by: Per Jessen
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
On Sat, Jun 28, 2008 at 1:33 PM, Jim Lucas <[EMAIL PROTECTED]> wrote:
> Robert Cummings wrote:
>>
>> On Sat, 2008-06-28 at 11:27 -0400, Andrew Ballard wrote:
>>>
>>> On Sat, Jun 28, 2008 at 9:44 AM, Colin Guthrie <[EMAIL PROTECTED]>
>>> wrote:
>>>>
>>>> Robert Cummings wrote:
>>>>>
>>>>> I will never do it... it looks ugly,
>>>>
>>>> Only if you're not used to it. IMO this is how it should be taught in
>>>> all
>>>> the books and guides etc. If that was the case, the other way round
>>>> would be
>>>> ugly :)
>>>>
>>>>> especially when performing multiple
>>>>> if comparisons on the variable.
>>>>
>>>> Perhaps, but it's still not as ugly as a hideous error gone undetected
>>>> which
>>>> accidentally deletes all your customers' data.
>>>
>>> ---snip---
>>>
>>>
>>> I don't know about "ugly," but I agree it "feels" wrong. I feel like
>>> I'm using Yoda-speak when reading code like that:
>>>
>>> If 'yes' is you_can_read_this, 'Stop standing on me' I say.
>>>
>>> or
>>>
>>> If 0 is my_pulse then 'dead you are' should say you.
>>
>> *lol* Exactly... just doesn't sit right.
>>
>> It's a good way to make sure you're not screwing up, but testing should
>> take care of that too.
>>
>> Cheers,
>> Rob.
>
> But whoever said the flow of the English language was all that efficient? I
> actually prefer 'Yoda Speak'. Takes less to say more.
>
Say anything about efficiency never did I. :-) I was merely commenting
on a personal preference based largely on my perspective as a native
speaker of (US) English. Now - if I WERE to address efficiency, I
don't find "Yoda speak" to be any more efficient. It's usually the
same words just in a different order. What's more that order, while
quite natural for some languages, is not natural to me at all. As Bob
mentioned, it requires a little extra thought for my brain to push
certain phrases onto the mental stack before I can pop them off in an
order that "makes sense." In programming terms, any code that requires
the same amount of statements but requires more cycles to process is
not what I would consider more efficient.
As far as the programming practice that Colin was advocating, it is
not a bad habit. And as far as the computer is concerned, the
efficiency is a wash since the number of internal steps probably
doesn't change much. However, it doesn't always work. (I know - no one
claimed it did.)
<?php
if ($challenge_password_hash = $stored_password_hash) {
echo 'Welcome to the club!';
} else {
echo 'Stay out! This club is for members only!';
}
?>
Andrew
--- End Message ---
--- Begin Message ---
2008/6/28 Andrew Ballard <[EMAIL PROTECTED]>:
> Say anything about efficiency never did I. :-) I was merely commenting
> on a personal preference based largely on my perspective as a native
> speaker of (US) English. Now - if I WERE to address efficiency, I
> don't find "Yoda speak" to be any more efficient. It's usually the
> same words just in a different order. What's more that order, while
> quite natural for some languages, is not natural to me at all. As Bob
> mentioned, it requires a little extra thought for my brain to push
> certain phrases onto the mental stack before I can pop them off in an
> order that "makes sense." In programming terms, any code that requires
> the same amount of statements but requires more cycles to process is
> not what I would consider more efficient.
>
> As far as the programming practice that Colin was advocating, it is
> not a bad habit. And as far as the computer is concerned, the
> efficiency is a wash since the number of internal steps probably
> doesn't change much. However, it doesn't always work. (I know - no one
> claimed it did.)
>
> <?php
> if ($challenge_password_hash = $stored_password_hash) {
> echo 'Welcome to the club!';
> } else {
> echo 'Stay out! This club is for members only!';
> }
> ?>
>
> Andrew
>
In these instances you could rely on != behaviour instead of ==
behaviour, like this:
<?php
if ($challenge_password_hash != $stored_password_hash) {
echo 'Stay out! This club is for members only!';
} else {
echo 'Welcome to the club!';
}
?>
or, better yet:
<?php
if ($challenge_password_hash != $stored_password_hash) {
echo 'Stay out! This club is for members only!';
exit;
}
echo 'Welcome to the club!';
// Lots of code here that just saved itself another indent in my IDE
?>
Dotan Cohen
http://what-is-what.com
http://gibberish.co.il
א-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
--- End Message ---
--- Begin Message ---
This time its a line chart:
http://www.phpguru.org/line/test.html
BTW Is anyone else dumbfounded at the inability of the CANVAS tag to
render text natively? A gross oversight IMO.
--
Richard Heyes
--- End Message ---
--- Begin Message ---
Hi all,
Is it possible to add new character encodings to mbstring?
http://us.php.net/mbstring
If it is possible, then is there a procedure where I can submit "new
feature" requests?
Or is it possible for me to add the new character encodings myself?
Thanks,
Haluk
--- End Message ---
--- Begin Message ---
Haluk AKIN wrote:
> Hi all,
>
> Is it possible to add new character encodings to mbstring?
> http://us.php.net/mbstring
>
> If it is possible, then is there a procedure where I can submit "new
> feature" requests?
> Or is it possible for me to add the new character encodings myself?
You can certainly add them yourself - which ones are you mising?
/Per Jessen, Zürich
--- End Message ---