onthespot Posted May 1, 2010 Share Posted May 1, 2010 Hey guys, My first problem is that i'm having trouble with a variable name. $comp_name = "$subformat_$subgame_$subname_$subseason"; $_SESSION['comp_name'] = $comp_name; This seems to be returning just the value of $subseason? Is there a quick fix for this? Secondly, I am getting a undeclared function error. I have two functions in my class. One of the functions calls the other function. First function.... function flip($match) { $components = split('v', $match); return $components[1] . "v" . $components[0]; } Second function but only part of it (it's long!).... $s = flip($r); That is just a snippet of code from the second function. I am not sure if i should be declaring the function a different way? Thanks for reading Link to comment https://forums.phpfreaks.com/topic/200400-two-problems-functions-and-variables/ Share on other sites More sharing options...
ChemicalBliss Posted May 1, 2010 Share Posted May 1, 2010 1. Variable Names Variable names can contain underscores ( _ ), therefor you're asking it to echo $subformat_ rather than $subformat. You need to use concatenation: $comp_name = $subformat."_".$subgame."_".$subname."_".$subseason; 2. Deprecated Functions Some old functions have been deprecated due to bugs and/or newer functions. Using functions such as split(); is not recommended: http://uk3.php.net/split 3. Undeclared Function The function name it states in the error could not be found in memory - This means you have either; a) Typed the function name incorrectly (Function names are case-sensitive). b) Called a function before the function has been declared (usually the cause of a bad if condition. Somtimes eval() and other similar functions). c) Used an outdated PHP Function that no longer exists as part of PHP. Though usually PHP will give a DEPRECATED_FUNCTION Notice instead of an error. -cb- Link to comment https://forums.phpfreaks.com/topic/200400-two-problems-functions-and-variables/#findComment-1051664 Share on other sites More sharing options...
onthespot Posted May 1, 2010 Author Share Posted May 1, 2010 I wasnt declaring the function in the right place! And thanks for the help, solved everything now! Link to comment https://forums.phpfreaks.com/topic/200400-two-problems-functions-and-variables/#findComment-1051667 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.