[SOLVED] Strict Standards: Only variables should be passed by reference in file.php on line 30

Hi, I am currently developing a project on socket and I got simple warning that needed to be fixed. Though the problem is caused on my project related to socket but on further research, I found that it can be applicable on any problem that is found regarding the title.

So, I took a look on each and every references but couldn’t find what exactly it is but tried some random things. My line of code where:

If you want the solution, the solution is:

Explanation:
The variable needs to be passed but I just passed the direct value to the function and it required variable which was not fixed. So, I just defined all the variables that might be needed and got the solution. If you got any problem with this, please first define the variable and pass it to the variable as the variable is sent as a pointer and needs to be changed by PHP function.
Same problem might occur on “end()” function so, you need to declare and $array = [“a”,”b”,”c”]; or explode(“.”,$fileName); and then pass it to the function as end($array).
Whew!!! Problem solved.

Leave a Reply

Your email address will not be published. Required fields are marked *