Home  >  Article  >  Backend Development  >  what does php pre mean

what does php pre mean

藏色散人
藏色散人Original
2021-11-29 10:59:273085browse

php pre is a pre-typesetting mark, which is mainly used to maintain the uniformity of the format when outputting error codes or printing array output.

what does php pre mean

#The operating environment of this article: Windows7 system, PHP7.1, Dell G3.

php What does pre mean?

 
is an html tag, which means output as it is without changes.

Pre is mainly used in PHP code to output error codes, or to print array output to maintain the uniformity of the format.

For example:

<pre class="brush:php;toolbar:false">
<?php
$cars=array(
    array("aaa",1,20),
    array("bbb",2,30),
    array("ccc",3,40),
);
print_r($cars);
?>

what does php pre mean

Extended information

Tips for using html tag pre in PHP debugging:

In debugging In PHP programs, we often print information to view. The print_r function can be very convenient for printing array contents, but when printed, it is not indented according to the format, which seems very inconvenient.

A little trick is to use the pre tag, such as:

<pre class="brush:php;toolbar:false"><?php print_r($tempArr)?>

Example code:

1,'b'=>2,'c'=>array(1,2,3));
?>
<pre class="brush:php;toolbar:false"><?php print_r($tempArr)?>

The page is displayed as follows:

Array
[a] => 1
[b] => 2
[c] => Array
(
[0] => 1
[1] => 2
[2] => 3
)
)

Recommended study: " PHP video tutorial

The above is the detailed content of what does php pre mean. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn