By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,729 Members | 1,370 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,729 IT Pros & Developers. It's quick & easy.

when will php support alias name?

P: n/a
When using c++, we could do:
using abc = xxx.yyy; // am i right?

When using python we could do:
import abc.efg as efg

When will php support:

class My_Best_Class
{
}
define('MyClass', 'My_Best_Class');
$o = new MyClass; // use MyClass as aliasname of My_Best_Class?

It is very useful to me.
Or do you have any good ideas to do such name alias?

Jul 24 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On 24.07.2007 10:36 Yarco wrote:
When using c++, we could do:
using abc = xxx.yyy; // am i right?

When using python we could do:
import abc.efg as efg

When will php support:

class My_Best_Class
{
}
define('MyClass', 'My_Best_Class');
$o = new MyClass; // use MyClass as aliasname of My_Best_Class?

It is very useful to me.
Or do you have any good ideas to do such name alias?
Yes. Wait till php6 comes out. ;)
--
gosha bine

makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi
Jul 24 '07 #2

P: n/a
Hey, friend. Do you know any good websites/forumns related to php6?
News and details.

On Jul 24, 4:46 pm, gosha bine <stereof...@gmail.comwrote:
On 24.07.2007 10:36 Yarco wrote:
When using c++, we could do:
using abc = xxx.yyy; // am i right?
When using python we could do:
import abc.efg as efg
When will php support:
class My_Best_Class
{
}
define('MyClass', 'My_Best_Class');
$o = new MyClass; // use MyClass as aliasname of My_Best_Class?
It is very useful to me.
Or do you have any good ideas to do such name alias?

Yes. Wait till php6 comes out. ;)

--
gosha bine

makrell ~http://www.tagarga.com/blok/makrell
php done right ;)http://code.google.com/p/pihipi

Jul 24 '07 #3

P: n/a
On Jul 24, 4:36 am, Yarco <yarc...@gmail.comwrote:
When using c++, we could do:
using abc = xxx.yyy; // am i right?

When using python we could do:
import abc.efg as efg

When will php support:

class My_Best_Class
{}

define('MyClass', 'My_Best_Class');
$o = new MyClass; // use MyClass as aliasname of My_Best_Class?

It is very useful to me.
Or do you have any good ideas to do such name alias?
It sounds like you want the ability to change which class you use for
something by just changing it in one place. So, you might have
something like this:

define('DatabaseConnection', 'MySQLDatabaseConnection');

which could then later be easily changed to:

define('DatabaseConnection', 'OracleDatabaseConnection');

Without modifying the rest of your code. Is that what you're trying
to achieve? If so you should use the factory pattern:

class DatabaseConnection {

public static function factory() {
return new MySQLDatabaseConnection();
}
}

class MySQLDatabaseConnection extends DatabaseConnection {

....

}

etc.

Jul 24 '07 #4

P: n/a
I find one:
http://oss.backendmedia.com/PhP60

On Jul 24, 5:26 pm, Yarco <yarc...@gmail.comwrote:
Hey, friend. Do you know any good websites/forumns related to php6?
News and details.

On Jul 24, 4:46 pm, gosha bine <stereof...@gmail.comwrote:
On 24.07.2007 10:36 Yarco wrote:
When using c++, we could do:
using abc = xxx.yyy; // am i right?
When using python we could do:
import abc.efg as efg
When will php support:
class My_Best_Class
{
}
define('MyClass', 'My_Best_Class');
$o = new MyClass; // use MyClass as aliasname of My_Best_Class?
It is very useful to me.
Or do you have any good ideas to do such name alias?
Yes. Wait till php6 comes out. ;)
--
gosha bine
makrell ~http://www.tagarga.com/blok/makrell
php done right ;)http://code.google.com/p/pihipi

Jul 25 '07 #5

P: n/a
When will php support:
>
class My_Best_Class
{
}
define('MyClass', 'My_Best_Class');
$o = new MyClass; // use MyClass as aliasname of My_Best_Class?
Never, I hope. If you cannot even trust your identifiers, all hope of
maintaining code is gone forever.

Especially the example is stunning. This has nothing to do with object
orientation. If you do this the object-oriented way, you can use
factories, interfaces and subclasses.
Off course, a factory is a method (or a function), so you can SEE that
it is defined elsewhere. And you can even pass it parameters.

Best regards,
--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/
Jul 25 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.