It's more complicated than that. I've tried separating them in the past and it was annoying (and didn't have time to finish it off).
Andi
At 05:51 PM 10/29/2004 -0700, Sara Golemon wrote:
> - Adding new language constructs in mini releases is IMO not the way to > go as it will make it possible impossible to run script that use this > new construct not even parse on PHP 5.0.x servers. Adding normal new > functions does not have this problem of course, as those scripts are > still parsable. > I agree that it introduces the problem of individuals writing scripts which rely on this feature then publishing them and other users getting hurt/angry/confused when it doesn't work. However, I don't think that a major version (4->5) is any better than a minor version (5.0->5.1) as more than a few people are having issues with PHP5 specific OOP code breaking in 4.3 installations (i.e. PPP access modifiers).
Though to be fair... This doesn't prevent the scripts from parsing, it just makes then behave incorectly (probably worse overall, but there is a distinction).
> - Substring works just fine, adding this for performance reasons is IMO > invalid. > Absolutely, were a feature like this introduced, I (personally) would continue to use substr($str, -1) for at least a couple minor versions to come in the name of BC. However, when those extra couple minor versions have passed, I'd feel much better about using a feature that's "been around since the 5.1 days"... silly though it may be.
> - People might want to take this even further and request {1,3}, {-3,2} > and the like. (This was expressed in the past when talking about this > stuff) > They might... and the response to that is that it's a more siginificant modification/glut of the exisiting code than merely allowing negative offsets. The fact is allowing negative string offsets via the {} operator involves changing one line, and it's no major waste of CPU cycles. Full substr()esque behavior would be more bloat-intensive of course and I'd be inclined to side against that.
-Sara
Index: Zend/zend_execute.c =================================================================== RCS file: /repository/ZendEngine2/zend_execute.c,v retrieving revision 1.684 diff -u -r1.684 zend_execute.c --- Zend/zend_execute.c 22 Oct 2004 21:42:14 -0000 1.684 +++ Zend/zend_execute.c 30 Oct 2004 00:46:13 -0000 @@ -1210,7 +1210,7 @@ container = *container_ptr; result->str_offset.str = container; PZVAL_LOCK(container); - result->str_offset.offset = dim->value.lval; + result->str_offset.offset = dim->value.lval >= 0 ? dim->value.lval : (dim->value.lval + container->value.str.len); result->var.ptr_ptr = NULL; if (type == BP_VAR_R || type == BP_VAR_IS) { AI_USE_PTR(result->var);
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php