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? 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? 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
Archived
This topic is now archived and is closed to further replies.