TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Advanced PHP Programming (http://www.talkphp.com/advanced-php-programming/)
-   -   php5 (http://www.talkphp.com/advanced-php-programming/5538-php5.html)

ChrisR 08-06-2010 06:23 AM

php5
 
Ill start off by saying i think this would be the place to post this ;) Also if this is not meant to be posted on this forum feel free to delete it :p


Well i am working on a private project (not a forum but something for my self) and i am coding in php5 i know how to do basic OOP in php4 but i am trying to learn a lot about php5 and there are something i am having issues with finding on the web. ill do it in points.


(note this is not really code just mockup to try and show you what i mean)


1) Would this be logical in making a database layer.


PHP Code:


abstract class driver {


protected function 
connect (perms here) {

mysql_connect()

}


}


class 
db extends driver {


public function 
connect(perms here) {


parent::connect(perms here);





if its not logical what would be the best way to go about it?


2) when do you use static/final etc.. keywords as in my coding i have never seen the need for it or whens it best to use it.


3) When needing to use other classes in a class is it best to do it this way or is there a better way?


PHP Code:


class foo {


private 
$see NULL;


public function 
loo() {


global 
$see;


$this->see = &$see;


}


}


class 
see {


code here ....


}


$see = new see


So that's all i want to know right now also if you have any other tips for coding in php5 oo i am all ears.


All times are GMT. The time now is 02:02 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0