Re: [PHP-DEV] New function proposal

2015-10-13 Thread Mattias Gonzalez
Thanks all for the responses! I agree that it isnt a core functionallity, but it would be nice to have it always there to use. thank you for thinking its a good idea guys! 2015-10-10 17:22 GMT-03:00 Johannes Schlüter : > On Thu, 2015-10-08 at 12:05 -0300, Mattias Gonzalez wrote: > > I wanted t

Re: [PHP-DEV] New function proposal

2015-10-10 Thread Johannes Schlüter
On Thu, 2015-10-08 at 12:05 -0300, Mattias Gonzalez wrote: > I wanted to propose the "var_die($var)" functionallity. This can easily be done in userland. There is no relevant performance gain. I see no reason to add this to core. Having this in your userland library has the benefit that you can d

Re: [PHP-DEV] New function proposal

2015-10-09 Thread Sherif Ramadan
I think this is the most awesomest fantastical idea since sliced bread. +~0 On Thu, Oct 8, 2015 at 11:05 AM, Mattias Gonzalez wrote: > I wanted to propose the "var_die($var)" functionallity. > My mates and i use a lot var_dump($var);die; > > Since die() wont print an array just a string, i thin

Re: [PHP-DEV] New function proposal

2015-10-09 Thread Korvin Szanto
I agree with Ben on this, I personally use var_dump();exit; in my code a lot, but there's no reason this needs to be in the core and not in userland: function dd(...$args) { var_dump(...$args); exit; } On Fri, Oct 9, 2015 at 5:24 PM Kris Childress wrote: > Mattias, > > As an avid user o

Re: [PHP-DEV] New function proposal

2015-10-09 Thread Kris Childress
Mattias, As an avid user of var_dump($something); die(); I think this is a *fabulous* idea! Laravel has a good idea with dd(), I would like to see something that is quick and easy to type, that we can throw anything at.. Maybe something similar (basic example) to the following : function dd($

Re: [PHP-DEV] New function proposal

2015-10-09 Thread Ben Scholzen 'DASPRiD'
If you and your friends use that a lot, how about you just define a function for it in userland? There's absolutely no logical reason to have this in core. function var_die($value) { var_dump($value); exit; } On 08.10.2015 17:05, Mattias Gonzalez wrote: I wanted to propose the "var_die($var)"

[PHP-DEV] New function proposal

2015-10-09 Thread Mattias Gonzalez
I wanted to propose the "var_die($var)" functionallity. My mates and i use a lot var_dump($var);die; Since die() wont print an array just a string, i think it´ll be very useful. It should do the var_dump($var);and die(); what do you think?

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-25 Thread Etienne Kneuss
Hello, On Sun, Jan 25, 2009 at 4:24 PM, Lukas Kahwe Smith wrote: > > On 24.01.2009, at 19:19, Guilherme Blanco wrote: > >> Hi Oskar, >> >> Yes, you can use a plain array too. >> I was just giving you a normal approach (ArrayAccess inherited class) >> because you may want a special behavior under

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-25 Thread Lukas Kahwe Smith
On 24.01.2009, at 19:19, Guilherme Blanco wrote: Hi Oskar, Yes, you can use a plain array too. I was just giving you a normal approach (ArrayAccess inherited class) because you may want a special behavior under it too. Forget SplObjectStorage docs they're outdated read the source! =

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-24 Thread Guilherme Blanco
Hi Oskar, Yes, you can use a plain array too. I was just giving you a normal approach (ArrayAccess inherited class) because you may want a special behavior under it too. Forget SplObjectStorage docs they're outdated read the source! =) Undoubtely devs will not mark spl_object_hash a E_DE

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-24 Thread Oskar Eisemuth
Hello Guilherme The new implementation of spl_object_hash will solve it, since it's a faster implementation than the old one. Just one hint, you should not try to echo the generated hash, since it may have non-printable chars. I don't think that will be a problem... Also, your code may stil

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-24 Thread Guilherme Blanco
Oskar, The new implementation of spl_object_hash will solve it, since it's a faster implementation than the old one. Just one hint, you should not try to echo the generated hash, since it may have non-printable chars. Also, your code may still be possible to use SplObjectStorage. Etienne did a lo

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-23 Thread Oskar Eisemuth
Hello My usage for spl_object_id wouldn't be solved with SplObjectStorage, here is my current event handler (it uses spl_object_hash) I still have the plan to replace it with something better but it simply works, currently it's not possible to "free" an object. EVENT::register accepts a static c

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-22 Thread Etienne Kneuss
Hello, On Tue, Jan 20, 2009 at 2:38 PM, Etienne Kneuss wrote: > Hello, > > On Tue, Jan 20, 2009 at 2:23 PM, Guilherme Blanco > wrote: >> Etienne, >> >> We all already considered to not implement spl_object_id as long as >> spl_object_hash is optimized. > > Ok then, I'll provide a patch to improv

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Sebastian Bergmann
Roman Borschel schrieb: > Would you mind sharing (off-list) how you get data in and out of the > objects **transparently** Have a look at lp:php-object-freezer. -- Sebastian Bergmann http://sebastian-bergmann.de/ GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 686

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Nate Gordon
My personal favorite use of Reflection is Class Factories. While this could be done with: It seems a little blunt to me, it also doesn't support having a variable number of arguments to the constructor. I've seen some pretty egregious hacks to make the above code work with a variable number of

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Roman Borschel
On Jan 21, 2009, at 4:20 PM, Christian Schneider wrote: Nathan Rixham wrote: seems to me that many of the new requests coming in, including my own stupid ones are because people want to build fast decent orm's in php - Having built an ORM system myself I can say that you don't need Reflecti

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Nathan Rixham
Christian Schneider wrote: Nathan Rixham wrote: seems to me that many of the new requests coming in, including my own stupid ones are because people want to build fast decent orm's in php - Having built an ORM system myself I can say that you don't need Reflection (or even other fancy features

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Christian Schneider
Nathan Rixham wrote: > seems to me that many of the new requests coming in, including my own > stupid ones are because people want to build fast decent orm's in php - Having built an ORM system myself I can say that you don't need Reflection (or even other fancy features not yet in PHP) for this.

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Kenan R Sulayman
First: I'd understand, I've to build the caching system on my own; Second: I'd vote for speeding up Reflection. Thanks, -- (c) Kenan Sulayman Freelance Designer and Programmer Life's Live Poetry 2009/1/21 Nathan Rixham > Christian Schneider wrote: > >> Lukas Kahwe Smith wrote: >> >>> On 21.01.

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Nathan Rixham
Christian Schneider wrote: Lukas Kahwe Smith wrote: On 21.01.2009, at 12:00, Karsten Dambekalns wrote: On 21.01.2009 11:44 Uhr, Kenan R Sulayman wrote: I did propose the function because the construction in user-land is quite expensive; Reflection is expensive, indeed. The way we solved it f

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Sebastian Bergmann
Christian Schneider schrieb: > Yes, please. Keep clutter out of the engine especially for stuff which > should not be used often. If you are relying on Reflection to be fast > for you everyday code then you're IMHO doing something weird and it is > ok that you have to write your own caching for it

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Christian Schneider
Lukas Kahwe Smith wrote: > On 21.01.2009, at 12:00, Karsten Dambekalns wrote: > >> On 21.01.2009 11:44 Uhr, Kenan R Sulayman wrote: >>> I did propose the function because the construction in user-land is >>> quite >>> expensive; >> >> Reflection is expensive, indeed. The way we solved it for FLOW3

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Lukas Kahwe Smith
On 21.01.2009, at 12:00, Karsten Dambekalns wrote: Hi. On 21.01.2009 11:44 Uhr, Kenan R Sulayman wrote: I did propose the function because the construction in user-land is quite expensive; Reflection is expensive, indeed. The way we solved it for FLOW3 is to create a ReflectionService t

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Karsten Dambekalns
Hi. On 21.01.2009 11:44 Uhr, Kenan R Sulayman wrote: I did propose the function because the construction in user-land is quite expensive; Reflection is expensive, indeed. The way we solved it for FLOW3 is to create a ReflectionService that caches such information as long as the source doesn'

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Kenan R Sulayman
Thanks, I did propose the function because the construction in user-land is quite expensive; Actually tests showed: the user-land algorithm of mapping these objects (regarding a count of thousand; up to a half million objects / iterations) took 0,2 - 70 seconds to execute! Therefore: I would be v

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-21 Thread Guilherme Blanco
setAcessible() is the way to go! Doctrine 2.0 took advantage of it to be able to move to a completely VO mapping of models. =) Cheers, On Wed, Jan 21, 2009 at 5:43 AM, Sebastian Bergmann wrote: > Etienne Kneuss schrieb: >> Why can't you use Reflection in this case? It looks like you can quite >

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-20 Thread Sebastian Bergmann
Etienne Kneuss schrieb: > Why can't you use Reflection in this case? It looks like you can quite > easily implement that in userland from Reflection. Especially using setAcessible() which was added in PHP 5.3. -- Sebastian Bergmann http://sebastian-bergmann.de/ GnuPG Ke

Re: [PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-20 Thread Etienne Kneuss
Hello, On Tue, Jan 20, 2009 at 8:30 PM, Kenan R Sulayman wrote: > Hi, > I'd like to propose a new function: spl_class_vars / params / contents. > > Notice: I haven't figured out a name yet Please help me find one.. :-) > > The function returns an array of the contents of the given class-object.

[PHP-DEV] New function proposal: spl_class_vars / params / contents

2009-01-20 Thread Kenan R Sulayman
Hi, I'd like to propose a new function: spl_class_vars / params / contents. Notice: I haven't figured out a name yet Please help me find one.. :-) The function returns an array of the contents of the given class-object. The class-object parameter may be text or rather directly the object ( new f

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-20 Thread Etienne Kneuss
Hello, On Tue, Jan 20, 2009 at 2:23 PM, Guilherme Blanco wrote: > Etienne, > > We all already considered to not implement spl_object_id as long as > spl_object_hash is optimized. Ok then, I'll provide a patch to improve spl_object_hash's performance, which will also change it's output. Documenta

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-20 Thread Guilherme Blanco
Etienne, We all already considered to not implement spl_object_id as long as spl_object_hash is optimized. Regards, On Tue, Jan 20, 2009 at 11:20 AM, Etienne Kneuss wrote: > Hello, > > On Tue, Jan 20, 2009 at 1:41 PM, Hannes Magnusson > wrote: >> On Tue, Jan 20, 2009 at 13:26, Etienne Kneuss

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-20 Thread Etienne Kneuss
Hello, On Tue, Jan 20, 2009 at 1:45 PM, Guilherme Blanco wrote: > Hi, > > It seems SplObjectStorage will solve my issue. > We already spoke on pvt about how to handle things correctly too. > > Although this solve my issue, the point that Stan highlighted is > valid. You may not find a good place

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-20 Thread Etienne Kneuss
Hello, On Tue, Jan 20, 2009 at 1:41 PM, Hannes Magnusson wrote: > On Tue, Jan 20, 2009 at 13:26, Etienne Kneuss wrote: >> >> Could you please provide an example, with code, in which this function >> would be necessary ? (i.e. where you can't use SplObjeccctStorage) > > Why? > > As far as i under

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-20 Thread Guilherme Blanco
Hi, It seems SplObjectStorage will solve my issue. We already spoke on pvt about how to handle things correctly too. Although this solve my issue, the point that Stan highlighted is valid. You may not find a good place where to use it, but spl_object_hash is there and it has drawbacks. Just namin

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-20 Thread Hannes Magnusson
On Tue, Jan 20, 2009 at 13:26, Etienne Kneuss wrote: > > Could you please provide an example, with code, in which this function > would be necessary ? (i.e. where you can't use SplObjeccctStorage) Why? As far as i understand, the issue is that spl_object_hash() is slow and people want a faster a

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-20 Thread Etienne Kneuss
Hello, On Tue, Jan 20, 2009 at 11:47 AM, Stan Vassilev | FM wrote: > > Hi, > > I had a talk with Marcus, and he has agreed on this proposed solution: > > 1) SPL generates a pseudo-random session id/mask (for the current request, > do not confuse with $_SESSION), which consists of 32 random > byte

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-20 Thread Stan Vassilev | FM
Hi, I had a talk with Marcus, and he has agreed on this proposed solution: 1) SPL generates a pseudo-random session id/mask (for the current request, do not confuse with $_SESSION), which consists of 32 random bytes/characters. 2) The object is and the handler pointer are used to create a uni

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-20 Thread Etienne Kneuss
Hello, We already had that discussion in private, but here is a on-list summary: On Mon, Jan 19, 2009 at 5:39 PM, Guilherme Blanco wrote: > Ok, > > We'll use this method inside Doctrine ORM version 2.0, scheduled to be > released on September 1st, 2009. > > One main location where we are already

Re: [PHP-DEV] New function proposal: spl_object_id

2009-01-19 Thread Guilherme Blanco
Ok, We'll use this method inside Doctrine ORM version 2.0, scheduled to be released on September 1st, 2009. One main location where we are already using it is during Hydration process. The process of grab a DB tuple and convert it into an Object graph. Here is the usage. Each Object of the graph

Re: [PHP-DEV] New function proposal: spl_object_id

2008-12-17 Thread Marcus Boerger
Hello Etienne, Wednesday, December 17, 2008, 7:59:01 PM, you wrote: > Hello, > On Wed, Dec 17, 2008 at 7:29 PM, Lars Strojny wrote: >> Hi Guilherme, >> >> thanks for moving the discussion to the list. >> >> Am Mittwoch, den 17.12.2008, 15:31 -0200 schrieb Guilherme Blanco: >> [...] >>> It seems

Re: [PHP-DEV] New function proposal: spl_object_id

2008-12-17 Thread Lars Strojny
Hi Andi, Am Mittwoch, den 17.12.2008, 10:33 -0800 schrieb Andi Gutmans: > Shouldn't you be using RETURN_STRINGL with length and dup=0? Yes, the more recent implementation does exactly that :) cu, Lars signature.asc Description: Dies ist ein digital signierter Nachrichtenteil

Re: [PHP-DEV] New function proposal: spl_object_id

2008-12-17 Thread Etienne Kneuss
Hello, On Wed, Dec 17, 2008 at 7:29 PM, Lars Strojny wrote: > Hi Guilherme, > > thanks for moving the discussion to the list. > > Am Mittwoch, den 17.12.2008, 15:31 -0200 schrieb Guilherme Blanco: > [...] >> It seems that Marcus controls the commit access to SPL. So I'm turning >> the conversatio

RE: [PHP-DEV] New function proposal: spl_object_id

2008-12-17 Thread Andi Gutmans
Shouldn't you be using RETURN_STRINGL with length and dup=0? Andi > -Original Message- > From: Guilherme Blanco [mailto:guilhermebla...@gmail.com] > Sent: Wednesday, December 17, 2008 9:31 AM > To: internals Mailing List > Subject: [PHP-DEV] New function proposal: s

Re: [PHP-DEV] New function proposal: spl_object_id

2008-12-17 Thread Lars Strojny
Hi Guilherme, thanks for moving the discussion to the list. Am Mittwoch, den 17.12.2008, 15:31 -0200 schrieb Guilherme Blanco: [...] > It seems that Marcus controls the commit access to SPL. So I'm turning > the conversation async, since I cannot find him online at IRC. > So, can anyone review th

[PHP-DEV] New function proposal: spl_object_id

2008-12-17 Thread Guilherme Blanco
Hi, I spoke with some devs yesterday about spl_object_hash performance and alternatives to solve it. Seems that md5 applied inside it is the responsable for that. After some tips from Lars, we came with a patch (at the bottom of this email). The new proposed function is already being used in Doct

Re: [PHP-DEV] New function proposal urlappendvar()

2004-01-21 Thread Ivan Rodriguez
_ ALAPLAYA.COM http://www.alaplaya.com [EMAIL PROTECTED] - Original Message - From: "Rasmus Lerdorf" <[EMAIL PROTECTED]> To: "Juan Alonso" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, January 21, 2004 12:31

Re: [PHP-DEV] New function proposal urlappendvar()

2004-01-21 Thread James Devenish
In message <[EMAIL PROTECTED]> on Wed, Jan 21, 2004 at 02:43:57PM +0100, Petras Kudaras wrote: > Shouldn't that go into separate module (available from PEAR) or something? > Sticking as many things into the core as possible seems to be the reason > a lot of people don't like PHP ;) I don't know wh

Re: [PHP-DEV] New function proposal urlappendvar()

2004-01-21 Thread Petras Kudaras
James Devenish wrote: $url .= strstr($url,'?')?"?foo=$foo":"&foo=$foo"; Without wanting to make any comment about the merits of the proposed function, I would have thought there would be merit in having a set of generalised URL-manipulation functions (if someone wanted to write them, that is

Re: [PHP-DEV] New function proposal urlappendvar()

2004-01-21 Thread Andi Gutmans
At 07:53 PM 1/21/2004 +0800, James Devenish wrote: In message <[EMAIL PROTECTED]> on Wed, Jan 21, 2004 at 03:31:08AM -0800, Rasmus Lerdorf wrote: > > $url = urlappendvar($_SERVER['HTTP_REFERER'], 'foo', $foo); > > Generally we don't add functions to replace simple one-line PHP > expressions. > >

Re: [PHP-DEV] New function proposal urlappendvar()

2004-01-21 Thread James Devenish
In message <[EMAIL PROTECTED]> on Wed, Jan 21, 2004 at 03:31:08AM -0800, Rasmus Lerdorf wrote: > > $url = urlappendvar($_SERVER['HTTP_REFERER'], 'foo', $foo); > > Generally we don't add functions to replace simple one-line PHP > expressions. > > $url .= strstr($url,'?')?"?foo=$foo":"&foo=$foo"

Re: [PHP-DEV] New function proposal urlappendvar()

2004-01-21 Thread Rasmus Lerdorf
Generally we don't add functions to replace simple one-line PHP expressions. $url .= strstr($url,'?')?"?foo=$foo":"&foo=$foo"; -Rasmus On Wed, 21 Jan 2004, Juan Alonso wrote: > Hello list, > > I find often myself wanting to append a variable to an unknown url. The > problem is that you don

[PHP-DEV] New function proposal urlappendvar()

2004-01-21 Thread Juan Alonso
Hello list, I find often myself wanting to append a variable to an unknown url. The problem is that you don't know if you should append the var with ? or with &. Do you think it would be useful to have a builtin function that would do this automatically? example code as I do it actually: exam