Page 1 of 1

php function return

PostPosted: Mon Aug 04, 2008 5:16 am
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

Re: php function return

PostPosted: Mon Aug 04, 2008 6:40 am
by syrupcore
Not familiar with that <<< syntax >>> at all. What is it you're trying to do?

Re: php function return

PostPosted: Mon Aug 04, 2008 9:17 pm
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