I am trying to call a function from another function. I get an error:
Fatal error: Call to undefined function getInitialInformation() in controller.php on line 24
controller.php file:
require_once("model/model.php"); function intake() { $info = getInitialInformation($id); //line 24 }
model/model.php
function getInitialInformation($id) { return $GLOBALS['em']->find('InitialInformation', $id); }
Things already tried:
I am not able to figure this out. Am I missing something here?
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.
It means exactly what it says. You are using a function the software has no knowledge of. If you had copy pasted the function in Google you would have found more than a few topics on this. One of them being this one stackoverflow.com/questions/3682615/….
Fatal Error There are three (3) types of fatal errors: Startup fatal error (when the system can't run the code at installation) Compile time fatal error (when a programmer tries to use nonexistent data) Runtime fatal error (happens while the program is running, causing the code to stop working completely)
Put this code in a file called p.php
:
<?php class yoyo{ function salt(){ } function pepper(){ salt(); } } $y = new yoyo(); $y->pepper(); ?>
Run it like this:
php p.php
We get error:
PHP Fatal error: Call to undefined function salt() in /home/el/foo/p.php on line 6
Solution: use $this->salt();
instead of salt();
So do it like this instead:
<?php class yoyo{ function salt(){ } function pepper(){ $this->salt(); } } $y = new yoyo(); $y->pepper(); ?>
If someone could post a link to why $this has to be used before PHP functions within classes, yeah, that would be great.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With