How can you pass a variable by reference to a function in PHP?
- Using the '&' symbol before the variable
- Using the 'ref' keyword before the variable
- Prefixing the variable with a '#' symbol
- Using the '*' symbol before the variable
To pass a variable by reference in PHP, you use the '&' symbol before the variable name. This allows changes made to the variable within the function to affect the original variable outside the function. The other options are incorrect.
Loading...
Related Quiz
- How can you upload a file in PHP?
- Which of the following are common uses of for loops in PHP?
- Which PHP function can be used to convert a string to lowercase?
- You have an array in your PHP script and you're encountering issues with accessing or manipulating the values. How would you debug this?
- Which of the following PHP functions can be used to move an uploaded file to a desired location?