@PeeHaa Remember when you said to not use superglobals in classes? Imply you have a class where you handle storage (sessions/cookies), how can you set a new session without setting the value on the superglobal session array?
hey guys, is that possible to treat method as variable? I have a class and I want to use one method in another, but without calling it, just treating as variable
@BenBeri Generally what you would do is have a session class, which is responsible for all access to the superglobal. It's obviously not possible to completely avoid the superglobals otherwise you would never be able to access the data, but for the read-only ones (basically everything except $_SESSION) you would inject them from the bootstrap (as shown by @tereško above ^^) and for $_SESSION, if you must use the built-in session handler (which you shouldn't) then wrap it in an object
If you've already searched, I wont mock you with a 'let me google that for you" answer, however searching for "php function as variable" give the correct page of the manual as top result.
@tereško Sorry I bothered you. I asked cause was trying to help a friend understanding some PHP code. I haven’t been using PHP last few years and wasn’t sure about PHP OO rules. I saw method initializing routing system basing on other methods within the same class. Instead of callbacks arrays were passed into routing methods provided by framework. It seemed weird to me, so I just wanted to know if PHP method can be treated and passed like variable. I hoped for simple answer: yes/no. Thank you
> In a nutshell, a router dissects the HTTP request into it's constituent parts to figure out what the user is asking for. The dispatcher interprets that information and provides a response.
Hullo :)
I'm sorry if the title is not clear but I don't know how to ask this ( +, I'm not english native :/ )
So ! There, I'm trying to build a website with a php script that spit out a list of members. Everything works fine but the list is not taking into account by the html/css part.
The th...
@NikiC very well said, and I don't disagree with any of it
as far as the ZPP changes, considering you're not passing the length directly (but instead as part of the zend_string struct), the concerns around segfaults are gone. So++
By the way… Is there any reason why we don't simply fetch zvals directly in PHP_FUNCTION() and just do the typecheck via zpp? Returning zvals is now a) very cheap and b) on undefined zvals we can just return IS_UNDEF.
Guys I got a tiny question: on my earlier php file I have $row['firstName'] (which shows a teacher's name). And when you click on update, then you go through the another page (update page). On this page I have a dropdownlist where you can select a teacher. But I want to show the selected teacher's name from the earlier page, that depends on which teacher I selected. I already had tried to use: $selectedOption = $_POST[$row['first_name']];
By the way… Is there any reason why we don't simply fetch zvals directly in PHP_FUNCTION() and just do the typecheck via zpp? Returning zvals is now a) very cheap and b) on undefined zvals we can just return IS_UNDEF.
@NikiC I'm asking about zend_parse_parameters() to only check the required args/types and accessing directly the passed zvals in the function. (Instead of that big slow thing we're having now)
@khaverim np....but you ought to get in the practice of reading the parse error messages better.
Also that UDF stuff is not at all related to your question - it's about defining functions in C code, and then binding them to MySQL through a DLL or similar.
As strange as it sounds I need to slow down a SQL query. Currently I'm using Microsoft SQL Server 2008 R2 on an in-house development server with the AdventureWorks database. I'm in the process of testing some code and the queries that I'm running are too fast no matter what I try!
Basically I'm ...
Here are some behaviors that are appropriate:
- Asking members of the list to vote on an RFC
- Politely disagreeing with someone's proposal
- Leaving the voting window open longer than minimum
Here are some behaviors that are inappropriate:
- Asking members of the list to vote in a particular way
- Dominating a mailing list discussion
- Engaging in a heated debate
Uncaught exception 'Auryn\InjectionException' with message 'No definition available while attempting to provision typeless non-concrete parameter cookies' Hmm
It looks like it goes through the object $this->container, and check it's dependencies. I don't want to do that, I simply want him to place all $userContainer parameters with that object, why is it checking for it's dependencies?
$cookies is a parameter in one of the objects inside $this->container object
Without the : it says No definition available while attempting to provision typeless non-concrete parameter url' - $url is the first parameter of 'request' object , and 'request' is the first parameter in the class I am making
You're just doing it wrong. You should be either be aliasing interfaces to class names for Auryn to construct, or you should be creating those instances and then sharing them via 'share'.
@NikiC actually, we get significant performance improvements if we can inline the parameter parsing. I got 20-30% performance gains (in a tight loop $i=0; while (++$i<1e6) { chr(50); }) when I write instructions to verify parameters and fetch them from stack directly in the function body.
The slowest parts are when we have to parse the string and to handle the va_list.