- 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
How to pass reference parameters PHP?
In PHP, use &$ in function parameter to pass reference parameters.
Example
The PHP code is as follows
<!DOCTYPE html> <html> <body> <?php function referenceDemo(&$number){ $number=$number+100; return $number; } $number=900; echo "The actual value is=",$number,"<br>"; $result=referenceDemo($number); echo "The modified value is=",$result; ?> </body> </html>
Output
This will produce the following output
The actual value is=900 The modified value is=1000
Advertisements