PHP print() Function | Rookie Tutorial
Rookie Tutorial -- Learning is not only technology, but also dreams!
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
PHP Tutorial
PHP TutorialPHP IntroductionPHP InstallationPHP SyntaxPHP VariablesPHP echo/printPHP EOF(heredoc)PHP Data TypesPHP Type ComparisonsPHP ConstantsPHP StringsPHP OperatorsPHP If...ElsePHP SwitchPHP ArraysPHP Array SortingPHP Superglobal VariablesPHP While LoopPHP For LoopPHP FunctionsPHP Magic ConstantsPHP NamespacePHP Object-OrientedPHP Quiz
PHP Forms
PHP FormsPHP Form ValidationPHP Form - Required FieldsPHP Form - Validate Email and URLPHP Complete Form ExamplePHP $_GET VariablePHP $_POST Variable
PHP Advanced Tutorial
PHP Multidimensional ArraysPHP DatePHP IncludesPHP FilesPHP File UploadPHP CookiePHP SessionPHP E-mailPHP Secure E-mailPHP ErrorPHP ExceptionPHP FilterPHP Advanced FilterPHP JSON
PHP 7 New Features
PHP Database
PHP MySQL IntroductionPHP MySQL ConnectPHP MySQL Create DatabasePHP MySQL Create TablePHP MySQL Insert DataPHP MySQL Insert Multiple DataPHP MySQL Prepared Statements
PHP print() Function
Definition and Usage
The print() function outputs one or more strings.
Tip: The print() function is not actually a real function, so you do not have to use parentheses with it.
Tip: Similar to the echo statement, print() is a language construct, and parentheses can be omitted: print or print().
Syntax
print(arg)
Parameters
| Parameter | Description |
|---|---|
| arg | Required. Specifies the content to print. |
Technical Details
| Item | Description |
|---|---|
| Return Value: | Always returns 1. |
| PHP Version: | 4+ |
More Examples
Example 1
Use a string variable to print text:
Example 2
Use print and echo to print strings:
YouTip