I'm displaying a relatively "heavy" PHP page. I have several functions that each use a connection to the DB to grab some rows. I've noticed that making a new $con in each function slows things down a lot, so naturally I would like to use the same $con for each function on the page. I tried this:
$con = mysqli_connect("localhost","root","root", "mydb");
function fA($a, $b, &$con = $con)
{}
function fB($a, &$con = $con)
{}
You can see I'm trying to pass a pointer to $con for each function, but I get a syntax error, unexpected $con
for each one. (I could pass $con to the functions whenever I call them but doing it this way I don't have to go back and change every function call, and it looks neater)