- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
list() function in PHP
The list() function assigns variables as if they were an array. It returns the assigned array.
Syntax
list(variable1, variable2, variable 3, ...)
Parameters
variable1 − the first variable
variable2 − more variables
variable3 − more variables
Return
The list() function returns the assigned array.
Example
The following is an example −
<?php $arr = array("David","Jack"); list($one, $two) = $arr; echo "Selected candidates: $one and $two."; ?>
Output
The following is the output −
Selected candidates: David and Jack.
Advertisements