Home  >  Article  >  Backend Development  >  What does php function print_X mean?

What does php function print_X mean?

尚
Original
2019-10-30 16:11:572683browse

What does php function print_X mean?

php's function print_X is print_r(), which is used to print variables and display them in a more understandable form.

Recommended: php server

Syntax:

bool print_r ( mixed $expression [, bool $return ] )

Parameter description:

$expression: The variable to be printed, if given What is output is a string, integer or float type variable, and the variable value itself will be printed. If an array is given, the keys and elements will be displayed in a certain format. object is similar to an array.

$return: Optional, if true, the result will not be output, but the result will be assigned to a variable, if false, the result will be output directly.

Return value

$return If set to true, there will be a return value, which is an easy-to-understand string information.

Example

<?php
$a = array (&#39;a&#39; => &#39;apple&#39;, &#39;b&#39; => &#39;banana&#39;, &#39;c&#39; => array (&#39;x&#39;,&#39;y&#39;,&#39;z&#39;));
print_r ($a);
?>

The output result is:

Array
(
    [a] => apple
    [b] => banana
    [c] => Array
        (
            [0] => x
            [1] => y
            [2] => z
        )

)

The above is the detailed content of What does php function print_X 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