Hello everyone,
I hope you're all doing well. I have recently come across an issue while working with PHP and I was hoping someone could shed some light on it. I keep encountering the error message "PHP strict standards: Only variables should be passed by reference". As I'm relatively new to PHP, I am not exactly sure what this error means and how to fix it.
Allow me to provide a bit of context. I am working on a project where I need to modify an existing PHP code. Within the code, there is a function call that seems to be causing this error. From what I understand, passing variables by reference can be useful in certain situations, but it seems like this is not allowed in strict standards.
I would really appreciate it if someone could explain to me in simple terms what this error message means. Additionally, I would like to know how I can modify the code to fix this issue and meet the strict standards of PHP.
Thank you in advance for your help and expertise!

Hey there!
I've encountered this error before, and it can be a bit tricky to understand at first. The "PHP strict standards: Only variables should be passed by reference" message usually indicates that you're trying to pass a non-variable as a reference to a function.
One common scenario where this error occurs is when you try to pass a literal value or a constant as a reference to a function that expects a variable. For example, if you have code like this:
In this case, the error will be triggered because you're passing the literal value 'some value' instead of an actual variable. To fix this, you need to assign the value to a variable before passing it as a reference, like so:
By doing this, you're now passing a variable as a reference, which satisfies the strict standards of PHP.
I hope this explanation helps you understand the error better. Let me know if you have any further questions or need more examples!