Hey,
I'm new to PHP but have developed pages in other languages such as JSP.
I was wondering if PHP has a shortcut to insert output so you don't have to write <? echo (stuff); ?> all the time.
For example, in JSP you could either do:
<% out.println(x); %>
or
<%= x%>
Thanks
Output Shortcut
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Ahh ok thanks.. another question that is kind of related is I'm looping through database records and outputting for each record. When I look at the generated html, all the outputs from the echos are grouped together in one big paragraph. Is there a way to make the echo space down? (print vs. println in JSP)
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
r_barlow wrote:Ahh ok thanks.. another question that is kind of related is I'm looping through database records and outputting for each record. When I look at the generated html, all the outputs from the echos are grouped together in one big paragraph. Is there a way to make the echo space down? (print vs. println in JSP)
Code: Select all
echo "\n";Quick function for it:
Code: Select all
function println($str)
{
echo $str."\n";
}