public function &offsetGet($offset) {
//private $jsonContent = [];
if (is_null($offset)) {
$index = -1;
//php.net/manual/en/language.types.integer.php We only care about decimals though
//[1-9][0-9]*
//| 0
foreach($this->jsonContent as $key => $value) {
if( preg_match('~[1-9][0-9]*|0~',$key) && ($key > $index) ){
$index = (int) $key;
}
}
$index++;
Does this look like a correct implementation for ArrayAccess::offsetGet($offset)?
The regex is calculating the next available place where a value can be inserted. 'abc1' and '-1' will not match because the $offset does not equal null
@Leigh @Jeeves @JoeWatkins I'm not sure if I'm answering your questions correctly, but actually PHP does have an "AST making framework" that works. github.com/asmblah/uniter
You can basically write your front end code (to be parsed in the browser) in PHP. You have access to all of the expected JS objects, but access them in PHP syntax,
there are two ISP supplied routers connected directly to the lines, then an asus router doing the dual wan load balancing, the ISP routers have set the asus router in DMZ
12 * * host109-159-6-37.range109-159.btcentralplus.com (109.159.6.37) 35.119 ms
13 * host109-159-6-37.range109-159.btcentralplus.com (109.159.6.37) 34.969 ms 34.926 ms
there are wires everywhere in here ... I've run out of plug sockets, and ethernet ports ... I'm going to have to make holes in walls and new plug sockets, and shelves ... weekend is going to be loud, full of dust ... I need a sysadmin at home ...
@JoeWatkins Ok, thanks. Also, with the removal of Threaded::getTerminatedInfo(), what is the alternative way to find out what went wrong inside of another thread?
✈️️ Finnair flight 666, at 13 o'clock on Friday the 13th with a 13 year old aircraft, has landed safely in HEL… https://twitter.com/i/web/status/819904788192231424
@daviddan Do you see the general advantage of using an accessor like Loop or would you rather want to continue with the React style of passing the loop around everywhere?
Inversion of control makes sense for userland things. The problem is that the event loop should exist at the language level and we're just filling a gap in the language
I do if there is more than one loop. If there's only one loop, the only issue I see is that watchers that are registered might not get run when the program exits
@kelunik right ... which isn't an argument against inversion of control
in particular in a long-running process passing around the global event loop is less problematic
it's the short-lived nature of the php web sapi that makes IoC more difficult because you have folks using front controllers where you may or may not need any given dependency
But I'll admit, it's still a PITA to pass it around everywhere
@kelunik I disagree ... that's still a coder error. But you can obviate the need by establishing a standard (language inclusion of a global loop instance is a de facto standard) and this is all that the interop group is doing
@daviddan Yes, that one might be the biggest bugger when looking at the spec. The main reason for that is recovery after exceptions using async APIs still.
So running a separate loop in a shutdown hook for example.
@daviddan But even without stacked loops, there's the possibility of watchers being created before Loop::execute and then Loop::execute is run with a different driver, see second argument of Loop::execute.
@kelunik honestly, I don't understand enough about the need for the for "stacked" loops to speak intelligently about it. I do know what we've never had the need for it.
@Gordon Are you talking about changing the return type of php_implode? You could change it to a zend_string (ABI break) but you'd have to get that zend_string back into a zval for the return_value of PHP_FUNCTION(implode)
@Gordon There's a lot of convenience in having a variable defined as return_value *zval. A whole bunch of macros assume there is a variable defined that way (RETURN_*, for example)