The PHP learning knowledge introduced today is the output function of strings. There are four ways to send output to the browser. The echo structure can output multiple values at once, while print() only outputs one value. The function printf() creates a formatted string by inserting values into a template. The function print_r() is useful for debugging. It prints the contents of arrays, objects, and other strings in a more or less human-readable form.
1.echo() function.
Echo is a language structure:
echo "messi";//Without brackets
echo ("messi");//This is also possible
echo "messi","barce","best player";//You can use commas Split the specified output into multiple items
2.print() function.
The function print() sends a value (its parameter) to the browser. Returns true if the string is successfully displayed, otherwise (for example, at a certain moment when the page is output, the user pressed the browser's stop button) returns false:
can be returned. ("you're not listening to me!");
}
If the browser outputs normally, it will output hello, world, otherwise it will output you're not listening to me!.
3.printf() function.
The function printf() inputs a string established by replacing values into the template (format string). It is derived from the function of the same name in the C language. The first parameter of printf() is the format string. The remaining parameters are the values that will be substituted. The % character in the format string indicates a substitution.
1. Format modifiers
Each replacement tag in the template consists of a percent sign (%), which may be followed by the modifiers listed below, and ends with a type specifier (use '%%' in the output to get a single percent sign character).
2. Type specifier
b The parameter is an integer and displayed as a binary number
c The parameter is an integer and displayed as the character corresponding to the value
d The parameter is an integer and displayed as A decimal number
e or f The parameter is a double precision number and displayed as a floating point number
g The parameter is a precision double number and displayed as a floating point number
o The parameter is an integer and displayed as an octal number (8 is the base) number
s The parameter is a string and is displayed as a string
u The parameter is an unsigned integer and is displayed as a decimal number
x The parameter is an integer and is displayed as a hexadecimal (based on 16) Number, use lowercase letters
Follow the PHP Chinese website (www.php.cn)!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 Chinese version
Chinese version, very easy to use