
12-05-2006, 10:33 PM
|
|
Script-fu
|
 |
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
|
|
Quote:
Originally Posted by Gambet
How is it anymore useful than using @'s, SPCs, etc? It's not very practical besides for using to shorten the length of some lines of code. It all depends on personal style, since you can argue that either is easier to read.
Personally, I find it faster to not use format. If you misplace things while using format, then the outcome won't be that of which you intended, thus making you pay extra attention to where you place things in order for it to work correctly. It's more of a hassle for something that has no real practical use. You get the same outcome in the end.
It's not a matter of efficiency, it's a matter of personal choice, thus, making it less practical than you make it to be. Format() was created to simplify code, yet, it's much more of a hassle than simple writing the whole thing out. And, as I stated before, it's not really easier to read considering the fact that if you don't know how to use format, you wouldn't understand anything that that specific line of code was supposed to do.
It can be argued either way.
|
PHP Code:
temp.foo = "My " @ temp.animal @ " is eating my " @ temp.food @ " quite " @ temp.speed @ "! I am " @ temp.emotion @ "!";
PHP Code:
temp.foo = format("My %s is eating my %s quite %s! I am %s!", temp.animal, temp.food, temp.speed, temp.emotion);
I know which I would prefer to edit if I had to. |
__________________
|
|
|
|