Re: [PHP-DEV] Funny array function

2012-09-30 Thread Andrew Faulds
, and most effecient Not really. A PHP function to implement it, done without recursion, would be pretty efficient. And unless you're making tens of thousands of these operations, this is probably a case of premature optimisation. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Ru

Re: [PHP-DEV] POST, content-type: application/json and json_decode

2012-09-24 Thread Andrew Faulds
On 24/09/12 19:09, Andrew Faulds wrote: I think perhaps that's the wrong approach. It's valid JSON to have a list literal at the top level as well, Excuse my brief brain lapse. PHP arrays are fine for sequential data as well, and you could also have any other JSON literal value

Re: [PHP-DEV] POST, content-type: application/json and json_decode

2012-09-24 Thread Andrew Faulds
OST). Any ideas? Maybe a RFC would also be welcome to complete my suggestion? Thanks. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] mbstring, a proposition of additional functions

2012-09-24 Thread Andrew Faulds
. I would love such a library to be built into PHP. A more consistent approach to scalar operations would be great. "hello, world"->replace('world', 'php'); would be so much nicer than str_replace and forgetting the argument order. This is a little off-topic

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-19 Thread Andrew Faulds
On 19/09/12 19:21, Steve Clay wrote: On 9/19/12 2:01 PM, Andrew Faulds wrote: Some other ideas: $cb = (callable) $obj->bar; Ah, but (callable) that won't work for global functions, since (callable) is a cast, and (callable) is not usable as a cast (at least in 5.4.7): $a = (calla

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-19 Thread Andrew Faulds
On 19/09/12 18:56, Steve Clay wrote: On 9/19/12 1:19 PM, Andrew Faulds wrote: I completely agree. How about &function_name? Resembles C (function pointers!), and unless I'm getting confused, it isn't currently legal syntax for something else. $cb = & Foo::doSomething; $cb =

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-19 Thread Andrew Faulds
7;re bumping into a slightly different area of education here. Once users know where escaping applies, the names even in their shorter forms are fairly obvious as to which context they apply to. I think that specific education is better served with good quality documentation and examples (I

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-19 Thread Andrew Faulds
;all the OOP code is a waste of time" doesn't really add anything to this discussion. Arguing against this being OOP, which I think is useful and requires, at most, one extra line ($x = new Escaper), is silly. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC: alternative callback syntax

2012-09-19 Thread Andrew Faulds
ely agree. How about &function_name? Resembles C (function pointers!), and unless I'm getting confused, it isn't currently legal syntax for something else. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-19 Thread Andrew Faulds
from a basic simple foundation, which is how PHP's OO is built anyway. Don't complicate things because of personal preference. There is no reason it cannot stay a simple function call or two. Wrap that in as many classes as you wish on your own time. :) What's complex about a method

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-19 Thread Andrew Faulds
hat newbies like myself are incapable of understanding that $ctx->escape($str) and escape($ctx, $str) are essentially equivalent. Besides, examples in the documentation can make this very simple to understand. -- Andrew Faulds http://ajf.me/

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-19 Thread Andrew Faulds
h goodness no, let's please only do OOP with the language features. Creating ridiculous "procedural" OOP abstractions helps absolutely nobody. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: RFC: Implementing a core anti-XSS escaping class

2012-09-19 Thread Andrew Faulds
After that it seems like the discussion would be: 1) do we even need encoding or is UTF8 just fine UTF8-only is certainly not just fine. 2) what are the flags to be defined for different escaping methods $.02 -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-19 Thread Andrew Faulds
any JS variables/statements or anything else. Those can never ever be subject to any form of untrusted input. It needs to be clear it's a string literal though, and a literal at that. Otherwise it's a little unclear. Still, I'm more worried about the CSS. -- Andrew Faulds http://aj

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-19 Thread Andrew Faulds
var() only). CSS can also be sanitised if the user has access to properties and not just the property values. Paddy -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-18 Thread Andrew Faulds
h clone it. Would this minimise the amount of change (if any) ? To some extent, yes, but Rasmus is right in that there would be certain bugs. In C, we don't have implicit string casting, for example. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-18 Thread Andrew Faulds
s slightly off-topic) -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-18 Thread Andrew Faulds
ity issue, we should discuss it as such. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-18 Thread Andrew Faulds
p, I think something like these: escapeHTMLAttribute for attributes, escapeHTMLText for text inside tags, escapeXMLAttribute and escapeXMLContent, escapeJSStringLiteral, escapeCSSIdentifier, and another needs adding (for url('*') things), escapeCSSStringLiteral. -- Andrew Faulds htt

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-18 Thread Andrew Faulds
and signal processing context, a filter removes. In computer science, but not computer security, it processes. I'm very confused :P -- Andrew Faulds http://ajf.me/

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-18 Thread Andrew Faulds
the field of computer science etc. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC: Implementing a core anti-XSS escaping class

2012-09-18 Thread Andrew Faulds
ted as in-band signalling. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Why are the PHP namespaces different compared to C++?

2012-09-07 Thread Andrew Faulds
espaces. Them being different from C++'s shouldn't be a surprise, C++ is quite a different language. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] is GD being actively maintained?

2012-09-06 Thread Andrew Faulds
I briefly asked Pierre about a feature in it recently. By the sounds of it, it is being actively maintained, albeit perhaps slowly. -- Sent from my Android phone with K-9 Mail. Andrew Faulds http://ajf.me/ Rasmus Schultz wrote: I opened this bug report 2 years ago: https://bugs.php.net

Re: [PHP-DEV] Re: Moving to an AST-based parsing/compilation process

2012-09-06 Thread Andrew Faulds
;-- >Stanislav Malyshev, Software Architect >SugarCRM: http://www.sugarcrm.com/ >(408)454-6900 ext. 227 > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php -- Sent from my Android phone with K-9 Mail. Andrew Fauld

Re: [PHP-DEV] Re: Moving to an AST-based parsing/compilation process

2012-09-05 Thread Andrew Faulds
ng official PHP grammar. I'm just speculating here, but this would be pretty cool if we could do it. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Moving to an AST-based parsing/compilation process

2012-09-04 Thread Andrew Faulds
this area of work should be avoided. Rather, I am saying that I hope any work in this area would give the potential for additional resource usage very serious consideration. Adam -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Moving to an AST-based parsing/compilation process

2012-09-04 Thread Andrew Faulds
he process some might be changed, but I would expect no big changes. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Foreach list behaviour

2012-09-03 Thread Andrew Faulds
null. Ah, I guess I'm confusing GML and PHP array semantics, somehow... my bad. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Foreach list behaviour

2012-09-03 Thread Andrew Faulds
anywhere else in the language anyway. I'm starting to see huge inconsistencies with how list is being implemented in foreach. Possibly more importantly, since 1 should cast to, er, [1] (I think...), why is $a === NULL? -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime De

Re: [PHP-DEV] $obj->attr::method() is not allowed

2012-09-03 Thread Andrew Faulds
On 03/09/12 17:17, Laruence wrote: On Tue, Sep 4, 2012 at 12:05 AM, Andrew Faulds wrote: On 03/09/12 17:03, Laruence wrote: It is great parser(simple and fast) which make php works well for years.. No, it's not, it's overly complex. You have to define all sorts of different expr

Re: [PHP-DEV] $obj->attr::method() is not allowed

2012-09-03 Thread Andrew Faulds
rent one is bad, it will because a better parser tool shows up... Well, current one is bad. It only works well for some common cases. For others, it doesn.t -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] $obj->attr::method() is not allowed

2012-09-03 Thread Andrew Faulds
On 03/09/12 16:20, Ivan Enderlin @ Hoa wrote: Absolutely. PHP has no AST? Why? For historical reasons? I believe so. Rasmus's original parser was not exactly world-class ;) -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:

Re: [PHP-DEV] $obj->attr::method() is not allowed

2012-09-03 Thread Andrew Faulds
is done, I imagine this could be fixed. We could also add extra rules, but I think fixing the general issue is more important, since it's like plugging two holes in a barrel full of water that's just had a machine gun fired at it. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP

Re: [PHP-DEV] Foreach list behaviour

2012-09-03 Thread Andrew Faulds
t; >-- >Laruence Xinchen Hui >http://www.laruence.com/ > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php -- Sent from my Android phone with K-9 Mail. Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC for Adding __toString to DateTime

2012-09-03 Thread Andrew Faulds
02T18:19:05+0100 (Africa/Niamey) > Sounds good. >-- >Ryan McCue ><http://ryanmccue.info/> > >-- >PHP Internals - PHP Runtime Development Mailing List >To unsubscribe, visit: http://www.php.net/unsub.php -- Sent from my Android phone with K-9 Mail. Andrew Fauld

Re: [PHP-DEV] Release scheduling, branching & NEWS for 5.4

2012-09-03 Thread Andrew Faulds
e removed or replaced) -- Sent from my Android phone with K-9 Mail. Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC for Adding __toString to DateTime

2012-09-02 Thread Andrew Faulds
dable (default in ECMAScript, for instance) date/time format. I see no reason not to use it. Date/time should be UTC anyway when debugging. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC for Adding __toString to DateTime

2012-09-02 Thread Andrew Faulds
On 02/09/12 21:45, Derick Rethans wrote: Yes, and that format is ambigious like I just illustrated. cheers, Derick No, you just demonstrated the time offset format is ambiguous, not the UTC format. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To

Re: [PHP-DEV] RFC for Adding __toString to DateTime

2012-09-02 Thread Andrew Faulds
0+0100 ^ $ php -r 'date_default_timezone_set("Europe/London"); echo date_create("2012-12-31")->format(DateTime::ISO8601), "\n";' 2012-12-31T00:00:00+ ^ I'm a little confused as to what is going on

Re: [PHP-DEV] RFC for Adding __toString to DateTime

2012-09-02 Thread Andrew Faulds
there was a format, it would have to be constant imho. Then ISO8601, please. It's a single, unambiguous Date and Time format. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC for Adding __toString to DateTime

2012-09-02 Thread Andrew Faulds
re of them. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Exceptions Vs Errors

2012-09-02 Thread Andrew Faulds
27;s your opposition to moving to exceptions? -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] RFC for Adding __toString to DateTime

2012-09-01 Thread Andrew Faulds
ng on, I'm hoping you can give this RFC a look. - Will Oh, thank you Will! I saw the bug report suggesting it myself and was thinking of implementing it. I'm glad to see you thought the same way I did, and used the ISO-8601 format as the default. +1 from me. -- Andrew Faulds http://a

Re: [PHP-DEV] Re: Are exceptions allowed in php core?

2012-08-31 Thread Andrew Faulds
ving behind some NULL value, when it would be much easier to debug if it stopped since then you don't have a strange undefined application state. But that's just my opinion :) -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [VOTE] Generators

2012-08-30 Thread Andrew Faulds
- Sent from my Android phone with K-9 Mail. Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: [VOTE]Call for voting: support use list in foreach

2012-08-28 Thread Andrew Faulds
On 28/08/12 18:14, Will Fitch wrote: You're right. My apologies. Good, I was a little worried that I might have missed something you didn't. It's all well and good. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscri

Re: [PHP-DEV] Re: [VOTE]Call for voting: support use list in foreach

2012-08-28 Thread Andrew Faulds
t the vote at the moment, it's 11 to 4, or 11/15. That is above 2/3rds, which is 10/15. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: [VOTE]Call for voting: support use list in foreach

2012-08-28 Thread Andrew Faulds
hen accepted. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Re: [VOTE]Call for voting: support use list in foreach

2012-08-27 Thread Andrew Faulds
On 27/08/12 15:49, Derick Rethans wrote: On Mon, 27 Aug 2012, Andrew Faulds wrote: Hi derick, can't read the rules now, on mobile. If you're referring to top-posting/bottom-posting though, that's the fault of the Android Gingerbread email client, which sucks. So don't

Re: [PHP-DEV] Re: [VOTE]Call for voting: support use list in foreach

2012-08-27 Thread Andrew Faulds
Hi derick, can't read the rules now, on mobile. If you're referring to top-posting/bottom-posting though, that's the fault of the Android Gingerbread email client, which sucks. -- Sent from Samsung Mobile Andrew Faulds http://ajf.me/ Derick Rethans wrote: null

Re: [PHP-DEV] Re: [VOTE]Call for voting: support use list in foreach

2012-08-27 Thread Andrew Faulds
13 years after standardisation! C++ has better support, of course, but C++'s magic and abstractions don't seem appropriate. -- Sent from Samsung Mobile Andrew Faulds http://ajf.me/ Stas Malyshev wrote: Hi! > That's where it gets ugly, in my experience; there are lots of > med

Re: [PHP-DEV] Re: [VOTE]Call for voting: support use list in foreach

2012-08-26 Thread Andrew Faulds
They don't, you need voting karma too, having rfc karma isn't enough. And this is how democracy works, Stas. If voters don't bother to turn up, too bad. -- Sent from Samsung Mobile Andrew Faulds http://ajf.me/ Yahav Gindi Bar wrote: On Sun, Aug 26, 2012 at 8:42 PM, Stas

Re: [PHP-DEV] Older style frameworks ...

2012-08-25 Thread Andrew Faulds
On 25/08/12 14:44, Lester Caine wrote: Andrew Faulds wrote: ISPs should have moved to 5.3 long ago. If they haven't, that isn't our problem. I'll just refer you to http://w3techs.com/technologies/details/pl-php/5/all 5.3 is NOT being used because of the changes it

Re: [PHP-DEV] Older style frameworks ...

2012-08-25 Thread Andrew Faulds
On 25/08/12 14:27, Lester Caine wrote: Andrew Faulds wrote: OK Lester, you've whined enough, what do you want us to do? Freeze development for 5 years so ISPs can slowly catch up, or something? Simply taking care to provide fixed point that we can work to would have helped. LTS ver

Re: [PHP-DEV] Re: [VOTE]Call for voting: support use list in foreach

2012-08-25 Thread Andrew Faulds
t with uglier syntax! :P -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Older style frameworks ...

2012-08-25 Thread Andrew Faulds
t why the remaining ones don't work on PHP5.4 ... more work that I don't have time for :( OK Lester, you've whined enough, what do you want us to do? Freeze development for 5 years so ISPs can slowly catch up, or something? -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Default input encoding for htmlspecialchars/htmlentities

2012-08-23 Thread Andrew Faulds
On 23/08/12 17:15, Rasmus Lerdorf wrote: On 08/23/2012 09:09 AM, Andrew Faulds wrote: Personally, I think you should have just two encodings: page_encoding and internal_encoding. The former is for form input and page output (could be latin-1, for instance), and internal_encoding is the internal

Re: [PHP-DEV] Default input encoding for htmlspecialchars/htmlentities

2012-08-23 Thread Andrew Faulds
nicode entities). Input and output, on the web at least, are almost always going to match. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DEV] Huge breach of PHP policy regarding World Domination

2012-08-22 Thread Andrew Faulds
revert the repo immediately. Thanks, comrades. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] UTF-8 files and include

2012-08-22 Thread Andrew Faulds
Also, beware the unavailable UTF8 filenames on some older/badly configured VPS images. That's bitten me. I now have some files on my VPS with unreadable mangled UTF-8 names, because they were uploaded from my UTF-8-compliant desktop distribution. -- Sent from Samsung Mobile Andrew Faulds

Re: [PHP-DEV] removing an item from an array

2012-08-21 Thread Andrew Faulds
Um, Yasuo, have you looked at array_walk implementation and ascertained it is safe to change array structure while using it? Because I'm worried you're changing docs without doing so. -- Sent from Samsung Mobile Andrew Faulds http://ajf.me/ Yasuo Ohgaki wrote: Hi, 2012/8/22 Lev

Re: [PHP-DEV] re: removing an item from an array

2012-08-21 Thread Andrew Faulds
ay naming conventions. (Yasuo, I'm looking at you) Cheers, Levi Morrison Yeah, this looks like a good solution and we have the best of both worlds. We get int array_delete(&$array, $value, $strict=TRUE); and int array_udelete(&$array, $value, $callback=bool function ($value $key)); :)

Re: [PHP-DEV] re: removing an item from an array

2012-08-21 Thread Andrew Faulds
On 21/08/12 22:35, Yasuo Ohgaki wrote: 2012/8/22 Andrew Faulds : On 21/08/12 22:18, Yasuo Ohgaki wrote: 2012/8/22 Andrew Faulds : Er, so you're advocating adding another method to do the same thing? Why? Because novices don't know about array_walk(). I think I've written thi

Re: [PHP-DEV] re: removing an item from an array

2012-08-21 Thread Andrew Faulds
On 21/08/12 22:18, Yasuo Ohgaki wrote: 2012/8/22 Andrew Faulds : Er, so you're advocating adding another method to do the same thing? Why? Because novices don't know about array_walk(). I think I've written this over and over in this thread. So publicise array_walk() then.

Re: [PHP-DEV] Official Userland Library (was: removing an item from an array)

2012-08-21 Thread Andrew Faulds
On 21/08/12 21:44, Lars Schultz wrote: Am 20.08.2012 22:51, schrieb Andrew Faulds: On 20/08/12 21:43, Lars Schultz wrote: It's a ridiculous argument, IMO. Nothing you could add to core couldn't be implemented in userland code somehow. (yes, that's hyperbole, but there is very o

Re: [PHP-DEV] re: removing an item from an array

2012-08-21 Thread Andrew Faulds
On 21/08/12 21:32, Yasuo Ohgaki wrote: 2012/8/22 Andrew Faulds : On 21/08/12 21:00, Yasuo Ohgaki wrote: Hi 2012/8/22 Andrew Faulds : On 21/08/12 10:36, Yasuo Ohgaki wrote: Int would be better and callable should be accepted like array_walk(). It's better to have array_delete_recu

Re: [PHP-DEV] re: removing an item from an array

2012-08-21 Thread Andrew Faulds
On 21/08/12 21:00, Yasuo Ohgaki wrote: Hi 2012/8/22 Andrew Faulds : On 21/08/12 10:36, Yasuo Ohgaki wrote: Int would be better and callable should be accepted like array_walk(). It's better to have array_delete_recursive(), too. I updated the page. Callable? What? This is to remove a s

Re: [PHP-DEV] re: removing an item from an array

2012-08-21 Thread Andrew Faulds
ki.net -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- -- Tjerk -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DEV] On the general standard of discussion...

2012-08-21 Thread Andrew Faulds
t might be worth just making an RFC and voting on it. Because no sane person could keep track of the Generators thread just now with its ridiculous length. Thank you. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Official Userland Library (was: removing an item from an array)

2012-08-20 Thread Andrew Faulds
ure wether this is a good idea, but it struck me as a better solution than just saying: it's so simple, do it yourself. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Generators

2012-08-20 Thread Andrew Faulds
rs but they chose to copy and then *chance* the PHP language for their own effect. yield: Yields the value null with an auto-incrementing integer key. What is the usecase for this? cheers, Derick -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] [RFC] Generators

2012-08-20 Thread Andrew Faulds
, but consider type hints mean that if you return a completely wrong type, you can warn the programmer. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] re: removing an item from an array

2012-08-20 Thread Andrew Faulds
_search` to find the index and use `array_slice`. Want to remove all instances of the value in the array? Use `array_filter`. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] re: removing an item from an array

2012-08-20 Thread Andrew Faulds
On 20/08/12 18:43, Sebastian Krebs wrote: Am 20.08.2012 19:00, schrieb Andrew Faulds: On 20/08/12 17:47, Herman Radtke wrote: May be we should have something like array_delete_if($array, function($v, $k=null) { if ($v == 300) return true; }) So array_filter? I'll use it or lik

Re: [PHP-DEV] re: removing an item from an array

2012-08-20 Thread Andrew Faulds
ctually think it's a good idea or not. So let's make an RFC (I think array_delete($array, $value, $all=false), mirrors Python's replace-one-only by default), vote on it, and that can decide things. So we can avoid argument. Don't like the syntax? Vote against it, but I don&#

Re: [PHP-DEV] re: removing an item from an array

2012-08-20 Thread Andrew Faulds
. And there is another use case: removing of list items by value, instead of key. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] re: removing an item from an array

2012-08-20 Thread Andrew Faulds
someone else mentioned, PHP's universal collection datatype is a great thing. It is an associative array, it is a list, it is a tuple, it is a set, it can be used in many ways, it's incredibly versatile. Adding array_delete would allow you to use it like a set more easily. Just m

Re: [PHP-DEV] re: removing an item from an array

2012-08-19 Thread Andrew Faulds
On 20/08/12 00:16, Yasuo Ohgaki wrote: 2012/8/20 Andrew Faulds : On 20/08/12 00:05, Yasuo Ohgaki wrote: 2012/8/20 Etienne Kneuss : On Sun, Aug 19, 2012 at 11:57 PM, Yasuo Ohgaki wrote: 2012/8/18 Rasmus Lerdorf : On 08/17/2012 05:21 PM, Rasmus Schultz wrote: if(($key = array_search

Re: [PHP-DEV] re: removing an item from an array

2012-08-19 Thread Andrew Faulds
_if($array, function($v, $k=null) { if ($v == 300) return true; }) So array_filter? I'll use it or like for deleting, but the point of this thread is "intuitive function for deleting element(s)" array_delete($array, $value|callable) would be nicer for users, perhaps. A callable?

Re: [PHP-DEV] Re: Generators in PHP

2012-08-19 Thread Andrew Faulds
y opcodes for running code. That is a ginormous hack and it *will* cause problems with some code. I can't say much about this in particular, but using hacks and kludges to implement language features is probably not the best of ideas. Derick -- Andrew Faulds http://ajf.me/ -- PHP Inter

Re: [PHP-DEV] re: removing an item from an array

2012-08-18 Thread Andrew Faulds
On 19/08/12 01:39, Morgan L. Owens wrote: On 2012-08-19 10:25, Andrew Faulds wrote: On 18/08/12 14:52, Morgan L. Owens wrote: How simple is it? Does it: 1) Remove one occurrence of the element (presumably the first) or all? 2) Reindex the array (as someone else argued was necessary to make it

Re: [PHP-DEV] re: removing an item from an array

2012-08-18 Thread Andrew Faulds
on to do what should be a "simple statement". Support all of them and there will probably _still_ be someone who wants their own particular set of circumstances catered for without having to write their own function to do it. Just my 2¢. -- Andrew Faulds http://ajf.me/

Re: [PHP-DEV] Combined assignment operator for short ternary

2012-08-18 Thread Andrew Faulds
Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] re: removing an item from an array

2012-08-18 Thread Andrew Faulds
lient disconnected, I would do list.remove(client). Of course there might be better ways to implement this, but it was simple and worked. Anything wrong with allowing the same in PHP? -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] php_basic ...

2012-08-15 Thread Andrew Faulds
> Contact - http://lsces.co.uk/wiki/?page=contact > L.S.Caine Electronic Services - http://lsces.co.uk > EnquirySolve - http://enquirysolve.com/ > Model Engineers Digital Workshop - http://medw.co.uk > Rainbow Digital Media - http://rainbowdigitalmedia.co.uk > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Decorators Revisited

2012-08-15 Thread Andrew Faulds
ke the class have that interface, but just made the compiler error if it didn't implement everything required. > -- > Stanislav Malyshev, Software Architect > SugarCRM: http://www.sugarcrm.com/ > (408)454-6900 ext. 227 > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Generators in PHP

2012-08-09 Thread Andrew Faulds
On 09/08/12 16:58, Nikita Popov wrote: On Wed, Aug 8, 2012 at 10:55 PM, Andrew Faulds wrote: Hmm. This is just a quick thought: Considering the yield syntax will vary about needing () round it, why not make it a "fake" function (language construct). This way it's consistent:

Re: [PHP-DEV] Generators in PHP

2012-08-08 Thread Andrew Faulds
the yield syntax will vary about needing () round it, why not make it a "fake" function (language construct). This way it's consistent: yield(), yield($v), yield($k => $v), $a = yield(), etc. (yield $x) is just messy as an expression. We don't have (isset $x), we have isset

Re: [PHP-DEV] Generators in PHP

2012-08-08 Thread Andrew Faulds
ise that it's less ambiguous, but I don't like the idea of it. PHP's syntax has enough special cases already IMO. Regards, -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Error handling brainstorming

2012-08-06 Thread Andrew Faulds
ps going until it does something stupid, which can be quite irritating to debug. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Error handling brainstorming

2012-08-06 Thread Andrew Faulds
ors and then wonder why $file is some NULL or FALSE or other "error" value. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] php interactive shell without readline

2012-08-05 Thread Andrew Faulds
On 06/08/12 00:37, Ferenc Kovacs wrote: On Mon, Aug 6, 2012 at 1:22 AM, Andrew Faulds <mailto:a...@ajf.me>> wrote: On 06/08/12 00:21, Ferenc Kovacs wrote: On Mon, Aug 6, 2012 at 12:18 AM, Johannes Schlüter mailto:johan...@schlueters.de>>wrote:

Re: [PHP-DEV] php interactive shell without readline

2012-08-05 Thread Andrew Faulds
se #ifdefs to make it use the correct lib at compile-time, no? -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] php interactive shell without readline

2012-08-05 Thread Andrew Faulds
On 05/08/12 22:03, Ivan Enderlin @ Hoa wrote: On 05/08/12 20:56, Andrew Faulds wrote: On 05/08/12 19:44, Ivan Enderlin @ Hoa wrote: On 05/08/12 20:36, Andrew Faulds wrote: On 05/08/12 19:33, Ivan Enderlin @ Hoa wrote: On 05/08/12 12:39, Andrew Faulds wrote: Great, but couldn't you

Re: [PHP-DEV] php interactive shell without readline

2012-08-05 Thread Andrew Faulds
On 05/08/12 19:44, Ivan Enderlin @ Hoa wrote: On 05/08/12 20:36, Andrew Faulds wrote: On 05/08/12 19:33, Ivan Enderlin @ Hoa wrote: On 05/08/12 12:39, Andrew Faulds wrote: Great, but couldn't you type some command which would screw it up, by accident? What do you mean? Say

Re: [PHP-DEV] php interactive shell without readline

2012-08-05 Thread Andrew Faulds
On 05/08/12 19:33, Ivan Enderlin @ Hoa wrote: On 05/08/12 12:39, Andrew Faulds wrote: Great, but couldn't you type some command which would screw it up, by accident? What do you mean? Say your implementation uses some global variable called $history. Now say I type "$history = [

Re: [PHP-DEV] Integrate PECL into PHP

2012-08-04 Thread Andrew Faulds
people to load extensions from userland would go beyond fatal. Nikita Aren't shared hosting servers pretty well secured, though? If each site is under a different userid, surely it can't do much damage? -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Maili

Re: [PHP-DEV] php interactive shell without readline

2012-08-04 Thread Andrew Faulds
? -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DEV] Should we have some sort of isset()-like operator with default?

2012-08-04 Thread Andrew Faulds
: default $var ?= default => $var = $var ? default => $var = isset($var) ? $var : default| Thoughts? This is all hypothetical, of course. It is probably not difficult to implement, but I think it needs discussing before implementing, I am not going to rush. Thanks. -- Andrew Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

  1   2   3   >