Perad Posted May 9, 2007 Share Posted May 9, 2007 OK, this sounds like a stupid question and probably is. I have two files, file 1 has the classes. class Name { } etc File 2 has what i want to do with the class. It starts with require '../blogclass.php'; However, instead of implementing the class it is just displaying all the public parts of the class... does anyone know why this is happening? Quote Link to comment https://forums.phpfreaks.com/topic/50637-how-do-i-include-a-file-which-has-class-in-it/ Share on other sites More sharing options...
per1os Posted May 9, 2007 Share Posted May 9, 2007 //file 1 <?php $name = new Name(); // initiate class here ??? class Name { } ?> // file2 <?php require_once('../blogclass.php'); // to avoid double instantiation. print_r($name, true); // should print out the class object for testing ?> Is that what you are looking for? Quote Link to comment https://forums.phpfreaks.com/topic/50637-how-do-i-include-a-file-which-has-class-in-it/#findComment-249029 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.