Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Fatal error: Call to undefined function when function is defined

Tags:

php

I am getting an error in PHP:

PHP Fatal error:  Call to undefined function getCookie

Code:

include('Core/dAmnPHP.php');
$tokenarray = getCookie($username, $password);

Inside of dAmnPHP.php, it includes a function called getCookie inside class dAmnPHP. When I run my script it tells me that the function is undefined.

What am I doing wrong?

like image 760
Ben Alter Avatar asked May 30 '12 13:05

Ben Alter


People also ask

What is fatal error call to undefined function?

If you're getting a fatal error notification that begins with the following description “Uncaught Error: Call to undefined function ctype_xdigit()” , that means that the ctype_xdigit function is missing from PHP version installed on your hosting.

How do you fix an undefined error in Python?

Conclusion # The Python "NameError: name is not defined" occurs when we try to access a variable or function that is not defined or before it is defined. To solve the error, make sure you haven't misspelled the variable's name and access it after it has been declared.

What does undefined mean in Python?

What does it mean when a variable is undefined in Python? An undefined variable in the source code of a computer program is a variable that is accessed in the code but has not been declared by that code.


1 Answers

It looks like you need to create a new instance of the class before you can use its functions.

Try: $dAmn = new dAmnPHP; $dAmn->getCookie($username, $password);

I've not used dAmn before, so I can't be sure, but I pulled my info from here: https://github.com/DeathShadow/Contra/blob/master/core/dAmnPHP.php

like image 112
Maythe Avatar answered Nov 14 '22 22:11

Maythe