php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #8075 Make Function/Method return value a "direct" object
Submitted: 2000-12-01 23:31 UTC Modified: 2002-04-28 19:05 UTC
From: za_ka_ria at yahoo dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.2 OS: Redhat Linux 6.2
Private report: No CVE-ID: None
 [2000-12-01 23:31 UTC] za_ka_ria at yahoo dot com
What I mean is like this:

function &getDB() {
   global $DB;
   if (!isset $DB) $DB = new SomeDatabaseConnectionClass()
   return $DB
}

and in some function/method I just could use it like this
getDB()->query_limit($sql_text);

It sure will make my code a lot smaller.

TIA,


Zakaria

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-28 19:05 UTC] jimw@php.net
this is possible in ZE2.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 17 21:01:27 2024 UTC