Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does <? php echo ("<pre>"); ..... echo("</pre>"); ?> mean?

Tags:

html

php

The question is the tag <pre> </pre>

I've seen one script I am working on, uses it:

echo ("<pre>");

.... ....

echo ("</pre>");

What exactly does it do ?

Is it an Html tag or a PHP ?

I've searched on Google but nothing much comes out of it. When do we usually use that HTML tag?...or PHP tag?

like image 394
George Leow Avatar asked Jan 21 '11 08:01

George Leow


People also ask

What is echo Pre in PHP?

The PHP function echo() prints out its input to the web server response. echo("Hello World!"); prints out Hello World! to the web server response. echo("<prev>"); prints out the tag to the web server response.

What is echo tag in PHP?

The echo() function outputs one or more strings. Note: The echo() function is not actually a function, so you are not required to use parentheses with it. However, if you want to pass more than one parameter to echo(), using parentheses will generate a parse error.

How does echo PHP work?

Echo simply outputs the strings that it is given, if viewing in the browser it will output the strings to the browser, if it's through command line then it will output the strings to the command line. In index. php and backend.

What does pre tag mean in HTML?

The <pre> HTML element represents preformatted text which is to be presented exactly as written in the HTML file.


3 Answers

The <prev> tag doesn't exist, but it's probably the <pre> HTML tag to put around debug output, to improve readability. It's not a secret PHP hack. :)

like image 96
Merijn Avatar answered Nov 03 '22 05:11

Merijn


I think you're talking about <pre></pre>. element is displayed in a fixed-width font, and it preserves both spaces and line breaks.

try printing an array with a **<pre>** and whitout **<pre>**

$arr = array(1, 2, 3);

echo '<pre>';
print_r($arr);
echo '</pre>';

print_r($arr); 
like image 39
Mark Avatar answered Nov 03 '22 04:11

Mark


echo (""); is a php code, and <prev> tries to be HTML, but isn't.

As @pekka said, its probably supposed to be <pre>

like image 31
Nanne Avatar answered Nov 03 '22 03:11

Nanne