php function return

Discuss general web development questions. Help others and get help from others.

Moderator: kfury77

Post Reply
Elygen
Posts: 49
Joined: Wed Oct 12, 2005 4:55 am

php function return

Post by Elygen »

I have not use this method in a long time and can not remember the syntax.
return a function like this

Code: Select all

function x() {
return test<<<
this is a test;
<<< test
}
well its something like this. Does anyone know?

Thanks!!!!
Todd
User avatar
syrupcore
Top Contributor
Posts: 917
Joined: Thu Jul 21, 2005 12:58 am
Location: Portland, Oregon, usa
Contact:

Re: php function return

Post by syrupcore »

Not familiar with that <<< syntax >>> at all. What is it you're trying to do?
Elygen
Posts: 49
Joined: Wed Oct 12, 2005 4:55 am

Re: php function return

Post by Elygen »

This is it

<?php
function x() {
$test = <<<TEST
this is a test;
TEST;
return($test);
}
?>

You can put anything in the middle(where i have this is a test) and it will return. for example you can do

<?php
function ul() {
$ul= <<<ul
<ul>
<li>button1</li>
<li>button2</li>
</ul>
TEST;
return($ul);
}
?>

it will return the orderlist. probably not a good to abuse but for something unimportant it is good.

thanks
Post Reply