PHP5
| From: | Mina | Date: | Thu, 25 Mar 2004 12:20:59 +0000 |
| Subject: | PHP5 | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-26772@lists.php.net to get a copy of this message | ||
hello there ,
first congratulation all for the new PHP 5.
so while am testing and playing with it i got some
ideas
and wrote some code for it
check : http://echoegypt.com/php/php.tar.gz
<?PHP
require_once("./php/lang/ClassLoader.php");
/**************
after we require php/lang/ClassLoader.php
there is 1 known static class "ClassLoader"
using internal php __autoload() interceptor function
we can speed up the scripts
and free up our heads from the damn include :)
***************************/
import("php" , true);
/**************************
sure now you can add class into any folder into
import("whatever" , true) folder
for example PHPClass.php must has a class PHPClass
into whatever/some/folders or whatever/php/is/good
and just call $PHP =new PHPClass();
and the interceptor will call __autoload() which call
ClassLoader which will look into imported dirs and
include the class
import("php" , true); dont require or include any
files into this directory (open the dir and get file
names only)
import("php"); just store directory name and when
class called later it will look there , without open
the dir
import("phpfile.php"); also dont include it just store
the name it
the class name must be the same of the file name Class
- Class.php (Java style)
take look at php/lang/ClassLoader.php
**************************************/
$txt =
"pdbc:MySQL://127.0.0.1/database?username=mina&password=askme";
$WhateverYourDataEngine =
Database::getConnection($txt);
$WhateverYourDataEngine->query("select * from php;");
/******************************************
$txt =
"pdbc:pgsql://127.0.0.1/database?username=mina&password=askme";
etc ...
Java has JDBC why not PHP dont have PDBC :)
whatever php 5 is strong enough to make PDBC in a new
php look and write a drivers for all of database
supported by PHP
so we can write 1 code working with all databases by
just changing the URL
take look at php/sql/Driver.php simple db interface
take look at php/sql/Database.php
take look at php/sql/driver/MySQL.php just a
implementation for the Driver interface
i was think why not PHP 5 pear going thorw this way
**************************/
?>
thanks all for reading :)
take care.
__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html