function test()
{
var $test;
$test = mysql_connect();
}
isnt c++ code either, and there is no mysql_connect(). also c++ doesnt use $ for variables or have a function keyword, so of course it wont compile.
it would have to be more something like this
#include <cstdio>
using namespace std;
void test()
{
char *test;
test = "something";
printf(test);
}
int main()
{
test();
}
i think he was more saying he declares variables in php as good practice because its manditory in c++, not that he declares variables in c++ using var.
C++ requires all variables be declared before use with their data type.
and for ComputerNerd888 if you have always used var in php to declare variables, i dont know what to tell you about why it doesnt work now, i tried it and i got a parse error, i thought it was only for classes. if you do want to declare your variables, you can do it how i showed before
(int)$number;
(double)$value;
(string)$word;
(bool)$flag;
$list = array();
etc...