View Single Post
Old 06-10-2009, 03:23 AM   #2 (permalink)
Wildhoney
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,258
Thanks: 90
Wildhoney is on a distinguished road
Default

Hehe. Nonsense! But perhaps we can evolve this thread into something a little more meaningful

I used to wrap a lot of my items in functions. For $_GET I used to have g(), $_POST was p(), and $_GET/$_POST was gp(). These are all fine and dandy but they don't describe too well what is happening inside that function. Whether it's setting or getting, what it's setting or getting.

I was working with the open-source eCommerce system, Magento, a couple of weeks ago now, and I noticed, much to my disgust, that they were using function names with two underscores (__) to print labels. What were they thinking?

For instance:

php Code:
function __($szText)
{
    return $szText;
}

echo __('I love TalkPHP');

As it is, however, I much prefer the use of print and echo. They describe well what is happening, and in themselves they are not functions, but rather language constructs. Wrapping them in functions, insofar as I see, isn't preferable, particularly in terms of readability.

In addendum, I even dislike using printf , especially in amongst echoes and prints, because, from a superficial perspective, they are highlighted differently in Zend Studio, and the printf requires the items to be passed as arguments, unlike print and echo. It creates a mess!

I now always follow the rule that everything must describe, as best as they can, what its purpose is.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
The Following User Says Thank You to Wildhoney For This Useful Post:
Runar (06-10-2009)