PHP return Statement


PHP return statement immediately terminates the execution of a function when it is called from within that function.

This function is also used to terminate the execution of an eval() function or script file.

If this function is called from a global scope, the function stops the execution of the current script. If the current script file was included using include() or required(), then control goes back to the calling file.


return expression 

Where expression is any valid expression. Note that, since the return is not a function but a language construct, using parenthesis is not required.

Return values

Condition Return value
If called from within a function Returns the argument of the function.
If the current script file was included using include() or required() Value given to return().
If no parameter is supplied NULL is returned.


Code of p.php

echo "p";

Code of q.php

echo "q";

View the output of p.php

View the output of q.php

See also

continue, break

Previous: declare statement
Next: include and require

PHP: Tips of the Day

Convert HTML + CSS to PDF

Important: Please note that this answer was written in 2009 and it might not be the most cost-effective solution today in 2019. Online alternatives are better today at this than they were back then.

Here are some online services that you can use:

  • PDFShift
  • Restpack
  • PDF Layer
  • DocRaptor
  • HTML to PDF Rocket

Have a look at PrinceXML.

It's definitely the best HTML/CSS to PDF converter out there, although it's not free (But hey, your programming might not be free either, so if it saves you 10 hours of work, you're home free (since youalso need to take into account that the alternative solutions will require you to setup a dedicated server with the right software).

Ref : https://bit.ly/384yytr