I have a PHP function and I want it to equal a variable. Here is the code:
You can't make a function equal a variable, but how about a variable that equals a function?
$ItsaFunction = function() {
//Code goes here
};
You could also do
function ItsaFunction() {
//Code goes here
}
$ItsaFunction = ItsaFunction();
If I understand what to mean you want to check if there is a match in variables.
<?php
$letter = 'a';
$word = 'a';
function ItsaFunction($first, $sec){
if($first == $sec){
echo 'match';
}else{
//do something
}
ItsaFunction($letter,$word);
}
?>
function foo() {
echo "In foo()<br />\n";
}
$func = 'foo';
$func(); // This calls foo()