lucerias Posted November 14, 2006 Share Posted November 14, 2006 Below is the sample code of .php file, firstly, $CustomerClass is defined as a class called Customer, which is defined in Customer.php and then for $CustomerClass->Save(), i don't understand because Save() is a function inside Save.php file but not a function under Customer class, why we can define like that and what is the meaning of that? Thank you.require_once('include/Customer.php'); require_once('include/Save.php'); $CustomerClass = New Customer();$CustomerClass->Save(); Quote Link to comment Share on other sites More sharing options...
Caesar Posted November 14, 2006 Share Posted November 14, 2006 [code]<?php class myclass { function funkshun() { $currtime = time(); $currdate = date("M d, Y", $currtime); echo"$currdate"; } } $c = new myclass; $c->funkshun();?>[/code]Keep in mind, there are other methods, approaches, and options concerning OOP. I am trying to make the example as simplistic as possible. Hope that helps. Quote Link to comment Share on other sites More sharing options...
lucerias Posted November 15, 2006 Author Share Posted November 15, 2006 I understand what you want to say, but you call a function belongs to its class, this is typical OO working principle and my question is how come the existing code i saw calls a function not belong to its class but under a different .php file. Thank you. Quote Link to comment 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.