|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-06-29 06:32 UTC] cstdenis at hotmail dot com
I am requesting a feature of user defined 'superglobal' varables. This would be handy for a varable that is set in the header containing somthing like username or access level that is used throughout a script. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Dec 08 02:00:01 2025 UTC |
There are so many ways to shoot yourself in the foot in php if used wrongly that I feel the response given here is a bit moot point. Take ruby for example, yes you can totally fuck it up if you do stupid things but is it prone to the problems? No. I've created a very powerful database abstraction based on models and since you can't define constant instances of classes (eg. Account), being able to create superglobals (eg. $Account) would be the next closest thing but no. Because of these instead of this $events = Contacts->join('accounts', 'events')->where( Event['start_date']->gteq($start_date), Event['end_date']->lteq($end_date), Event['type']->eq($type), Contact['owner_id']->eq($current_user->id) )->project('firstname', 'lastname', Account['accountname'], Event['subject']); You have to do something like this (closest I have come so far) $events = M::$Contacts->join('accounts', 'events')->where( M::$Event['start_date']->gteq($start_date), M::$Event['end_date']->lteq($end_date), M::$Event['type']->eq($type), M::$Contact['owner_id']->eq($current_user->id) )->project('firstname', 'lastname', M::$Account['accountname'], $::$Event['subject']); Not that much worse but it compunds over time. Maybe the only reason why such feature doesn't exist is because somebody fucked up with certain other language magic in the first place.