An echo like function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Todd_Z
Forum Regular
Posts: 708
Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan

An echo like function

Post by Todd_Z »

Can i make a custom function that would work without parentheses, like this =>

Code: Select all

show "Hello, my name is $name";
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

what? 8O
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

no.
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

...

Post by s.dot »

Why would you need to?
echo "Hi, my name is $name"; would do just that... so why would you need an echo like function?
User avatar
Todd_Z
Forum Regular
Posts: 708
Joined: Thu Nov 25, 2004 9:53 pm
Location: U Michigan

Post by Todd_Z »

Basically I was going to make a function (show) that automatically formatted the output of the webpage so that I wouldn't have to deal with the
\n's and the \t's which go along with my obsession with perfect source. And since i like the whole echo "string"; look w/o the parentheses (idk why) i was hoping i could do that with show.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

did you look at heredoc?

Code: Select all

echo <<<STOP
blahlahblahala
$var blahlbah
tab blalahlab
STOP;
http://php.net/types.string
Post Reply