[PHP] Send a variable to a function

Associate
Joined
10 Jul 2006
Posts
2,423
Hi there,

I was wondering if it was possible to send a variable to a function in PHP and use it.

Eg:

Code:
<?

$variableString = "string";

function stringConc($string, $variable){

     $variable .= $string;

}

stringConc("hello string",$variableString);

//Below will echo "stringhello string" - well thats what i want it to do.
echo $variableString;

?>

Hope that makes sense.

Thanks.
 
Last edited:
...well it doesn't work...at least not for me.

I just put that code in an attempt to try and represent what i am trying to do.

I have edited and added a comment to my original post of what I want it to output.
 
Back
Top Bottom