Jump to content

[SOLVED] Little problem with class scope.


Anti-Moronic

Recommended Posts

I have 3 files, index, funcs, and test.

 

In index I have:

 

<?php

include("funcs.php");

include("test.php");

?>

 

in funcs:

 

<?php

class simple{

   function speak(){

   echo "it works";

   }

}

$simple = new simple;

?>

 

..and in test, I have:

 

<?php

$simple->speak();

?>

 

The problem is that it is not finding the class. Can anyone explain why? Any help is greatly appreciated. Thanks.

 

EDIT: ERROR:

 

Call to undefined method simple::speak()

Link to comment
https://forums.phpfreaks.com/topic/159037-solved-little-problem-with-class-scope/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.