Vide documentation:
Note: There is no reference signal in function call - only in function settings. The function definitions alone are sufficient to pass the argument by reference. From PHP 5.3.0 you will receive a "call-time pass-by-Ference" alert that is obsolete when using & na in function calls: foo(&$a);. From PHP 5.4.0, passing by reference in the call has been removed, and using it will cause a fatal error.
That is, only the signature of the function that must indicate that the passage will be made by reference and not by value. From version 5.4 on calls using the character &
will cause a syntax error as you got.
That is, on the call from exec
just do:
exec('Done.exe', $resultado);
Even if the variable does not exist in the context it will be created to receive the value defined by the function.
I removed the HTML, CSS, Javascript and Node tags because I saw no relation to the question. If there is a relationship, I recommend that you edit the question in detail.
– Woss
And on the basis that you claim that the
exec
isn’t working? Did you make a mistake? Which one? WhatDone.exe
does? Is it in the same directory? Is the user allowed to run it? What are the latest messages in your PHP server’s log file?– Woss
Parse error: syntax error, Unexpected '&', expecting ')' in C: xampp htdocs Execute index.php on line 8
– Schiller Drummond
The file is in the same folder as index.php
– Schiller Drummond
To pass a variable as a reference in PHP only the function argument needs to indicate the
&
. You don’t need to indicate this in the function call, so just doexec('Done.exe', $resultado)
– Woss
The Done.exe file runs a C++ game that I programmed and the error to give is this: syntax error, Unexpected '&', expecting ')' in C: xampp htdocs Run index.php on line 8
– Schiller Drummond