[PHP-DEV] array(...)[]

2004-10-17 Thread Klaus Reimer
Hi, I've just seen that finally it's possible to do "$object->getOtherObject()->doSomething()" with PHP5 which was not possible in PHP4. But I wonder why something like this still does not work: $object->returnArray()[$index] returnArray()[$index] array(1,2,3,4)[$index] It would be really

[PHP-DEV] Array syntax []

2008-01-10 Thread Andi Gutmans
Andi 2003: http://www.mail-archive.com/internals@lists.php.net/msg03896.html Andi's brain evolves 2007: http://marc.info/?l=php-internals&m=117057393530217&w=2 And today I'm still +1. I really think by looking at some of the examples I worked through with my original posting in February

[PHP-DEV] Array Question

2004-06-17 Thread Jason Garber
Hello, In PHP4 and PHP5 the following syntax works fine (note the last comma): array ( 1 => 'bob', 2 => 'sam', ); Is being able to have a comma at the END of an array definition a supported feature, or an undocumented feature that should not be used? Thanks, Jason Garber _

Re: [PHP-DEV] array(...)[]

2004-10-17 Thread Markus Fischer
Klaus Reimer wrote: I've just seen that finally it's possible to do "$object->getOtherObject()->doSomething()" with PHP5 which was not possible in PHP4. But I wonder why something like this still does not work: $object->returnArray()[$index] returnArray()[$index] array(1,2,3,4)[$index] It

[PHP-DEV] Array Keys

2003-11-03 Thread LingWitt
Now that objects are accounted for by references and id, it should be possible to use them as keys in an associative array. That might be an interesting feature to have. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Array syntax []

2008-01-10 Thread Rasmus Lerdorf
And my stance hasn't changed either: http://marc.info/?l=php-internals&m=117060700805108&w=2 Andi Gutmans wrote: Andi 2003: http://www.mail-archive.com/internals@lists.php.net/msg03896.html Andi's brain evolves 2007: http://marc.info/?l=php-internals&m=117057393530217&w=2 And today I'

Re: [PHP-DEV] Array syntax []

2008-01-10 Thread Antonio Touriño
Hello all, The array() syntax to me screams function call, something that, in my mind, did not intuitively mean assign an array to a plain ole variable. If I can: $var1 = 5; why would I need a special function call "array()" to create and assign an array? An array is just like any other variab

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Lokrain
Hello mr. Antonio Touriño, So as if I understand, you want to change the syntax of array() keyword. Will you mind to update the changes in all php scripts in the world too? PS. You can always have your [] in custom patch, but I do not think it's useful to want it globally changed.

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Vesselin Kenashkov
It is not about changing, it is about adding a different way to declare arrays (the function-style way will remain). The current code base will be unaffected. +1 vote from me to add ['x'=>'y'] On Jan 11, 2008 10:05 AM, Lokrain <[EMAIL PROTECTED]> wrote: > Hello mr. Antonio Touriño, > > So as if

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Derick Rethans
On Thu, 10 Jan 2008, Andi Gutmans wrote: > I think almost everyone here agreed it'd benefit them and maybe the ones > who don't would go through the same process I went through once they get > used to it J I don't know about that, I for once find it silly to even try to argue that [] is a good i

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Derick Rethans
On Thu, 10 Jan 2008, Antonio Touriño wrote: > The array() syntax to me screams function call, something that, You mean just like if(), for(), while(), foreach(), elseif() and... ? regards, Derick -- Derick Rethans http://derickrethans.nl | http://ezcomponents.org | http://xdebug.org -- PHP I

RE: [PHP-DEV] Array syntax []

2008-01-11 Thread Richard Black
-1 Now, back to lurking... == Richard Black - Senior Consultant DataVisibility Ltd Tel. 020 7917 9570 http://www.datavisibility.com/ Registered Office: 212 Picc

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Lukas Kahwe Smith
On Jan 11, 2008, at 1:18 PM, Pierre wrote: +1 (for the record in this thread :) -1 regards, Lukas -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Pierre
+1 (for the record in this thread :) -- Pierre http://blog.thepimp.net | http://www.libgd.org -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread chris#
On Thu, 10 Jan 2008 15:51:51 -0800, "Andi Gutmans" <[EMAIL PROTECTED]> wrote: > Andi 2003: > http://www.mail-archive.com/internals@lists.php.net/msg03896.html > > > > Andi's brain evolves 2007: > http://marc.info/?l=php-internals&m=117057393530217&w=2 > > > > And today I'm still +1. > >

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Ryusuke SEKIYAMA
+1 -- Ryusuke SEKIYAMA -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Jani Taskinen
-1 On Fri, 2008-01-11 at 13:18 +0100, Pierre wrote: > +1 (for the record in this thread :) > > > > -- > Pierre > http://blog.thepimp.net | http://www.libgd.org > -- Patches/Donations: http://pecl.php.net/~jani/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit:

RE: [PHP-DEV] Array syntax []

2008-01-11 Thread Ford, Mike
+1 for (b) FWIW Cheers! Mike - Mike Ford, Electronic Information Services Adviser, JG125, The Headingley Library, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email:

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Ilia Alshanetsky
-1 Ilia Alshanetsky -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Daniel Brown
On Jan 11, 2008 10:30 AM, Markus Fischer <[EMAIL PROTECTED]> wrote: > -1 > > Readability degrades quite a lot. +1 (b) Readability will only degrade as much as the coder allows it to. Besides, I don't get the impression that array() is going to disappear, only that another option is to be

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Sam Barrow
+1 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread KUBO Atsuhiro
+1 (b) Regards, -- KUBO Atsuhiro e-mail: [EMAIL PROTECTED] -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Guilherme Blanco
+1 (b) If you think foo([]) is not readable, it's simple... don't use it. Also, JS defines this since its begining and none until today said it is not readable. Regards, On Jan 11, 2008 11:19 AM, Ford, Mike <[EMAIL PROTECTED]> wrote: > +1 for (b) FWIW > > Cheers! > > Mike > > -

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Mark Dennehy
+1 -- Mark Dennehy

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Markus Fischer
-1 Readability degrades quite a lot. -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Jeff Griffiths
Rasmus Lerdorf wrote: And my stance hasn't changed either: http://marc.info/?l=php-internals&m=117060700805108&w=2 ... +1 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Sam Barrow
On Fri, 2008-01-11 at 10:05 +0200, Lokrain wrote: > Hello mr. Antonio Touriño, > > So as if I understand, you want to change the syntax of array() keyword. > Will you mind to update the changes in all php scripts in the world too? > > PS. You can always have your [] in custom patch, but I do not

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Stephan Schmidt
+1 Best regards Stephan -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Jochem Maas
-1 -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DEV] Array syntax []

2008-01-11 Thread Tullio Andreatta ML
+1 (option b) -- Tullio Andreatta 09:f9:11:02:9d:74:e3:5b:d8:41:56:c5:63:56:88:c0 45:5f:e1:04:22:ca:29:c4:93:3f:95:05:2b:79:2a:b2 Disclaimer: "Please treat this email message in a reasonable way, or we might get angry" ( http://www.goldmark.org/jeff/stupid-disclaimers ) -- PHP Internals - P

Re: [PHP-DEV] Array Question

2004-06-17 Thread Derick Rethans
On Thu, 17 Jun 2004, Jason Garber wrote: > Hello, > > In PHP4 and PHP5 the following syntax works fine (note the last comma): > > array > ( > 1 => 'bob', > 2 => 'sam', > ); > > > Is being able to have a comma at the END of an array definition a supported > feature, or an undocumented fea

Re: [PHP-DEV] Array Question

2004-06-17 Thread Antony Dovgal
On Thu, 17 Jun 2004 10:33:39 +0200 (CEST) Derick Rethans <[EMAIL PROTECTED]> wrote: > On Thu, 17 Jun 2004, Jason Garber wrote: > > > Hello, > > > > In PHP4 and PHP5 the following syntax works fine (note the last > > comma): > > > > array > > ( > > 1 => 'bob', > > 2 => 'sam', > > ); > >

Re: [PHP-DEV] Array Question

2004-06-17 Thread Adam Maccabee Trachtenberg
On Thu, 17 Jun 2004, Jason Garber wrote: > Is being able to have a comma at the END of an array definition a supported > feature, or an undocumented feature that should not be used? If I remember correctly, Zeev or Andi specifically added it as a result of a user request, so I'd say it's an undoc

Re: [PHP-DEV] Array Question

2004-06-17 Thread Robert Cummings
On Thu, 2004-06-17 at 11:20, Adam Maccabee Trachtenberg wrote: > On Thu, 17 Jun 2004, Jason Garber wrote: > > > Is being able to have a comma at the END of an array definition a supported > > feature, or an undocumented feature that should not be used? > > If I remember correctly, Zeev or Andi sp

Re: [PHP-DEV] Array Question

2004-06-17 Thread Hartmut Holzgraefe
Robert Cummings wrote: At the end of the array definition or after the last defined array entry? If the latter... good feature. Hope it's there to stay since it makes cutting and pasting to arrays a lot easier and various other automated array building tasks :) thats exactly what it is in for, savi

Re: [PHP-DEV] Array Question

2004-06-17 Thread Red Wingate
I guess that was <= 4.1.0 as i get errors at work ( 4.0.x ) and everything went fine as i misstyped today using 5.0.0rc3 :-) --red Adam Maccabee Trachtenberg wrote: On Thu, 17 Jun 2004, Jason Garber wrote: Is being able to have a comma at the END of an array definition a supported feature, or

Re: [PHP-DEV] Array Question

2004-06-17 Thread Mehdi Achour
This is now [1] a fixed documentation bug :) I didn't find anything about it in the ChangeLog, nor bugs.php.net, so I didn't include any version information in the docs. Drop a mail to the documentation list if you figure it out ;) didou [1] - http://cvs.php.net/diff.php/phpdoc/en/reference/array/

Re: [PHP-DEV] Array Question

2004-06-17 Thread Jay Smith
Mehdi Achour wrote: > This is now [1] a fixed documentation bug :) > I didn't find anything about it in the ChangeLog, nor bugs.php.net, > so I didn't include any version information in the docs. > Drop a mail to the documentation list if you figure it out ;) > > didou > > [1] - > http://cvs.php

Re: [PHP-DEV] Array Question

2004-06-17 Thread Andi Gutmans
This is a supported feature as it especially helps with machine generated arrays. If it's not documented it should be. Andi At 04:03 AM 6/17/2004 -0400, Jason Garber wrote: Hello, In PHP4 and PHP5 the following syntax works fine (note the last comma): array ( 1 => 'bob', 2 => 'sam', ); Is

Re: [PHP-DEV] Array Question

2004-06-17 Thread Jason Garber
Cool. Thanks for updating the docs. I think it will save confusion with others in the future. ~Jason At 6/17/2004 11:34 PM +0200, Mehdi Achour wrote: This is now [1] a fixed documentation bug :) I didn't find anything about it in the ChangeLog, nor bugs.php.net, so I didn't include any version i

[PHP-DEV] Array spread append

2023-04-05 Thread Vorisek, Michael
Hello, I would like to open a discussion for https://github.com/php/php-src/issues/10791 . [https://opengraph.githubassets.com/a23cb565cc8acac6a33ecab5d9ee68a46f046a1ffe215501673156e506695430/php/php-src/issues/10791] Array spread append · Issue #10791

[PHP-DEV] array and call_user_function

2008-09-08 Thread mr esnafrao
Hi all, I'm having problems passing an array to the function call_user_function as parameter. This is the code: zval *args[3], *func, *retval; MAKE_STD_ZVAL(func); MAKE_STD_ZVAL(retval); MAKE_STD_ZVAL(args[0]); MAKE_STD_ZVAL(args[1]); MAKE_STD_ZVAL(args[2]); ALLOC_HASH

[PHP-DEV] Array max size

2018-08-01 Thread Marcos Passos
Whenever you look for more information about the maximum size of an array, you find someone saying that "PHP arrays do not have a maximum size, but the amount of memory available". However, I could not find any excerpt in PHP documentation that supports that. Even if the engine imposes no hard lim

Re: [PHP-DEV] Array Keys

2003-11-04 Thread LingWitt
I don't want to seem naggish, but what do you think? On 3 Nov 2003, at 8:26 AM, [EMAIL PROTECTED] wrote: Now that objects are accounted for by references and id, it should be possible to use them as keys in an associative array. That might be an interesting feature to have. -- PHP Internals -

Re: [PHP-DEV] Array Keys

2003-11-04 Thread Andi Gutmans
At 09:14 PM 11/4/2003 -0500, [EMAIL PROTECTED] wrote: I don't want to seem naggish, but what do you think? On 3 Nov 2003, at 8:26 AM, [EMAIL PROTECTED] wrote: Now that objects are accounted for by references and id, it should be possible to use them as keys in an associative array. That

Re: [PHP-DEV] Array Keys

2003-11-05 Thread netcat
[EMAIL PROTECTED] wrote: I don't want to seem naggish, but what do you think? On 3 Nov 2003, at 8:26 AM, [EMAIL PROTECTED] wrote: Now that objects are accounted for by references and id, it should be possible to use them as keys in an associative array. That might be an interesting feature

Re: [PHP-DEV] Array Keys

2003-11-05 Thread LingWitt
I noticed that echo $object statements in PHP 5 display object ids that are kept by the engine, so this data is already in the string form and it is data that exists. As for as a use for this feature, one can't easily say there is not a use; there have been times when I wished to have this feat

Re: [PHP-DEV] Array Keys

2003-11-06 Thread Andi Gutmans
At 08:01 PM 11/5/2003 -0500, [EMAIL PROTECTED] wrote: I noticed that echo $object statements in PHP 5 display object ids that are kept by the engine, so this data is already in the string form and it is data that exists. As for as a use for this feature, one can't easily say there is not a use;

Re: [PHP-DEV] Array Keys

2003-11-06 Thread LingWitt
Alright. On 6 Nov 2003, at 2:58 AM, Andi Gutmans wrote: At 08:01 PM 11/5/2003 -0500, [EMAIL PROTECTED] wrote: I noticed that echo $object statements in PHP 5 display object ids that are kept by the engine, so this data is already in the string form and it is data that exists. As for as a use fo

[PHP-DEV] Array broken in 5_2?

2007-06-22 Thread Pierre
Hi, If you run 'make test' using 5.2 (maybe head too, did not test), I get a lot of errors like: Notice: Undefined offset: 534 in /home/pierre/cvs/php52_dev/run-tests.php on line 1682 and obviously many tests fail. As far as I can tell, something have been broken recently. The tests have work

[PHP-DEV] Array objects & array functions

2008-01-05 Thread Amir Abiri
Hi, I was wondering if there are any plans to introduce the ability of array functions to work with "array objects". More specifically I was thinking of starting with adding an SPL interface called ArraySearchable, and modifying php_search_array in ext/standard/array.c to accept an object that

Re: [PHP-DEV] Array spread append

2023-04-05 Thread Juliette Reinders Folmer
On 6-4-2023 0:12, Vorisek, Michael wrote: Hello, I would like to open a discussion for https://github.com/php/php-src/issues/10791 . [https://opengraph.githubassets.com/a23cb565cc8acac6a33ecab5d9ee68a46f046a1ffe215501673156e506695430/php/php-src/issues/10791]

Re: [PHP-DEV] Array spread append

2023-04-05 Thread Andreas Hennings
> I have the feeling I'm missing something, but how would this compare to array join Array join does neither append nor replace if a numeric index already exists. But you can do [...$arr0, ...$arr1]. https://3v4l.org/CIinR print json_encode([ [...['a', 'b'], ...['c', 'd']], // [a, b, c, d]

Re: [PHP-DEV] Array spread append

2023-04-06 Thread mickmackusa
Call me sentimental, but are we just trying to choke out the few remaining reasons to keep array_push() in the language? Okay, yeah, sometimes at is a drag that the first parameter has to be declared in advance and is modified by reference (which means you can't enjoy null coalescing or short tern

Re: [PHP-DEV] Array spread append

2023-04-06 Thread Michał Marcin Brzuchalski
Hi Mick czw., 6 kwi 2023 o 10:00 mickmackusa napisał(a): > Call me sentimental, but are we just trying to choke out the few remaining > reasons to keep array_push() in the language? > > Okay, yeah, sometimes at is a drag that the first parameter has to be > declared in advance and is modified by

Re: [PHP-DEV] Array spread append

2023-04-06 Thread Ilija Tovilo
Hi Michael > I would like to open a discussion for > https://github.com/php/php-src/issues/10791 . > [https://opengraph.githubassets.com/a23cb565cc8acac6a33ecab5d9ee68a46f046a1ffe215501673156e506695430/php/php-src/issues/10791] > Array spread append ·

Re: [PHP-DEV] Array spread append

2023-04-06 Thread Vorisek, Michael
02Cq - `$arr[...] = &$arr` should be compile error Michael From: Ilija Tovilo Sent: Thursday, April 6, 2023 12:18 PM To: internals@lists.php.net Subject: Re: [PHP-DEV] Array spread append Hi Michael > I would like to open a discussion for > https://

Re: [PHP-DEV] Array spread append

2023-04-06 Thread mickmackusa
> > > * Are integer keys preserved? I'm assuming no, as otherwise it would > be the same as `$a + $b`. > > $arr[...] = $arr; > should be the same as > foreach ($arr as $v) { $arr[] = $v; } > > all other answers should be answered from this and consistency Since `$arr1[...] = $arr2;` should be con

Re: [PHP-DEV] Array spread append

2023-04-06 Thread G. P. B.
On Thu, 6 Apr 2023 at 14:04, mickmackusa wrote: > I think it would be more intuitive to implement an array "appending" > functionality with "concatenating" syntax. The `.=` syntax already exists, > but is forbidden from use on non-strings. If you want to implement this > preexisting syntax as a

Re: [PHP-DEV] Array spread append

2023-04-06 Thread Michał Marcin Brzuchalski
czw., 6 kwi 2023, 13:53 użytkownik Vorisek, Michael napisał: > Hi Ilija, > > * Are integer keys preserved? I'm assuming no, as otherwise it would > be the same as `$a + $b`. > > $arr[...] = $arr; > should be the same as > foreach ($arr as $v) { $arr[] = $v; } > I'd argue with that because I thin

Re: [PHP-DEV] Array spread append

2023-04-06 Thread Vorisek, Michael
5:01 PM To: Vorisek, Michael Cc: PHP internals Subject: Re: [PHP-DEV] Array spread append czw., 6 kwi 2023, 13:53 użytkownik Vorisek, Michael mailto:voris...@fjfi.cvut.cz>> napisał: Hi Ilija, * Are integer keys preserved? I'm assuming no, as otherwise it would be the same as `$a +

Re: [PHP-DEV] Array spread append

2023-04-07 Thread Tim Düsterhus
Hi On 4/6/23 00:12, Vorisek, Michael wrote: I would like to open a discussion for https://github.com/php/php-src/issues/10791 . For the discussion phase to actually be open (with regard to the minimal discussion period before a vote on an RFC may be opened), an actual RFC needs to exist.

Re: [PHP-DEV] Array spread append

2023-04-07 Thread Bob Magic
> I think it would be more intuitive to implement an array "appending" > functionality with "concatenating" syntax. The `.=` syntax already exists, > but is forbidden from use on non-strings. If you want to implement this > preexisting syntax as an array concatenation operator, then it is a blan

Re: [PHP-DEV] Array spread append

2023-04-08 Thread Niels Dossche
Hi On 4/6/23 00:12, Vorisek, Michael wrote: > Hello, > > I would like to open a discussion for > https://github.com/php/php-src/issues/10791 . > [https://opengraph.githubassets.com/a23cb565cc8acac6a33ecab5d9ee68a46f046a1ffe215501673156e506695430/php/php-src/issues/10791]

Re: [PHP-DEV] Array spread append

2023-04-09 Thread Hans Krentel via internals
On Saturday 08 April 2023 22:17:14 (+02:00), Niels Dossche wrote: > However, I think it might be worth adding an optimization for the most common $x = array_merge($x, ...) case. If so, then syntax wise I'd throw that suggestion in the ring: $x[] = ... $y ; This would allow to adopt exi

Re: [PHP-DEV] Array spread append

2023-04-10 Thread Tim Düsterhus
Hi On 4/8/23 22:17, Niels Dossche wrote: I think this could be made more generic, and be cleaned up. But I don't know if something like this is desired in PHP. Yes, please. I believe that “performance” should not influence API design if it can be avoided. Instead the heavy lifting of optimiza

Re: [PHP-DEV] Array spread append

2023-04-10 Thread Niels Dossche
Hey Tim On 10/04/2023 14:45, Tim Düsterhus wrote: > Hi > > On 4/8/23 22:17, Niels Dossche wrote: >> I think this could be made more generic, and be cleaned up. >> But I don't know if something like this is desired in PHP. > > Yes, please. I believe that “performance” should not influence API des

[PHP-DEV] Array dereferencing of scalars

2015-06-08 Thread Christoph Becker
The behavior of dereferencing scalars as if they were arrays or strings is arguable: NULL This happens without notice or warning, whereas the array dereferencing of objects results in a fatal error: https://bugs.php.net/bug.php?id=54556> [2] [3]

[PHP-DEV] array/HashTable filling optimization

2006-09-27 Thread Matt W
Hi all, I noticed awhile ago how most every use of zend[_u]_hash_init has nSize as 0. Of course it isn't always known how many elements will be added to the array (nTableSize), but there are places where an accurate value could be used instead of getting the minimum default (8). For anyone who d

Re: [PHP-DEV] array and call_user_function

2008-09-08 Thread Marcus Boerger
Hello mr, Monday, September 8, 2008, 6:58:19 PM, you wrote: > Hi all, > I'm having problems passing an array to the function call_user_function as > parameter. This is the code: > zval *args[3], *func, *retval; args maust be *** not ** > MAKE_STD_ZVAL(func); > MAKE_STD_ZVAL(retval)

Re: [PHP-DEV] array and call_user_function

2008-09-10 Thread mr esnafrao
Thanks for your response, but I'm unable to make it work. I have changed the code, and it works with strings and even with arrays, but not with hashes: Am I missing something? zval *hash; zval **args[2], *func, *retval; zval *str; MAKE_STD_ZVAL(retval); MAKE_STD_ZVAL(func); ZVAL_STRIN

Re: [PHP-DEV] array and call_user_function

2008-09-10 Thread mr esnafrao
I have solved the problem. I had confused the functions hash_* with the funtions array_*. This works: MAKE_STD_ZVAL(hash); array_init(hash); g_hash_table_iter_init (&iter, m->params); while (g_hash_table_iter_next (&iter, &key, &value)) { add_assoc_string(hash, key, value,

[PHP-DEV] array coalesce operator concept

2017-07-11 Thread Mark Shust
Hello, I wanted to garnish feedback on a RFC proposal. This is just a concept at this point, and is inspired by the null coalesce operator. Code will error if a non-array value is passed through a looping feature. For example, this code:

Re: [PHP-DEV] Array max size

2018-08-01 Thread Lester Caine
On 01/08/18 19:41, Marcos Passos wrote: My understanding is that the conceptual limit is*PHP_INT_MAX*, as there is no way to represent the size above this value. And on which definition, 32bit versions of PHP crash out before 64bit builds ... It assumes that one HAS to convert variables to bin

Re: [PHP-DEV] Array max size

2018-08-01 Thread Levi Morrison
On Wed, Aug 1, 2018 at 12:42 PM Marcos Passos wrote: > > Whenever you look for more information about the maximum size of an array, > you find someone saying that "PHP arrays do not have a maximum size, but > the amount of memory available". However, I could not find any excerpt in > PHP documenta

Re: [PHP-DEV] Array max size

2018-08-01 Thread Levi Morrison
On Wed, Aug 1, 2018 at 12:42 PM Marcos Passos wrote: > > Whenever you look for more information about the maximum size of an array, > you find someone saying that "PHP arrays do not have a maximum size, but > the amount of memory available". However, I could not find any excerpt in > PHP documenta

Re: [PHP-DEV] Array max size

2018-08-01 Thread Sherif Ramadan
It's undocumented, because it's considered undefined behavior. PHP arrays implicitly store the number of elements internally as an unsigned 32 bit integer (regardless of architecture). This means that (technically) you can't create an array with more than ((2**31) - 1) elements (or 2,147,483,647 el

Re: [PHP-DEV] Array max size

2018-08-01 Thread Marcos Passos
It looks like the limit I mentioned, used by some functions, is architecture-dependent: https://github.com/php/php-src/blob/master/Zend/zend_types.h#L288 Also, that's such a ridiculously large number for the vast majority of > people using PHP that hardly anyone ever runs into this limit. The po

Re: [PHP-DEV] Array max size

2018-08-01 Thread Marcos Passos
*The point is not about the possibility of crossing the limit of the array, but the need for a definition so one can design a method or function whose behavior aligns with the array capabilities. This need, in fact, became more noticeable from a design point of view since the introduction of the it

Re: [PHP-DEV] Array max size

2018-08-01 Thread Sherif Ramadan
Right, and therein lies the problem. No one has ever defined this behavior. As such, one cannot document what has never been defined. What you're describing is UNdefined. Undefined things cannot be documented. On Wed, Aug 1, 2018, 3:46 PM Marcos Passos wrote: > *The point is not about the poss

Re: [PHP-DEV] Array max size

2018-08-01 Thread Marcos Passos
If you are arguing strictly about not knowing what to write on the documentation, let's move the discussion towards whether it should be defined or not. 2018-08-01 16:51 GMT-03:00 Sherif Ramadan : > Right, and therein lies the problem. No one has ever defined this > behavior. As such, one cannot

Re: [PHP-DEV] Array max size

2018-08-01 Thread Sara Golemon
On Wed, Aug 1, 2018 at 2:41 PM, Marcos Passos wrote: > Whenever you look for more information about the maximum size of an array, > you find someone saying that "PHP arrays do not have a maximum size, but > the amount of memory available". However, I could not find any excerpt in > PHP documentati

[PHP-DEV] Array behaviour change intentional?

2003-06-21 Thread Lars Torben Wilson
Hi there, It seems that array appending has changed wrt negative indices. I had just documented the new behaviour but now I'm not entirely sure whether I've just documented an unintentional change. Is this new behaviour what is desired (i.e. skipping straight from some negative key to 0 when appe

[PHP-DEV] Array indexing BC question

2003-06-23 Thread Lars Torben Wilson
Hi out there, Wondering what should go into the docs about this: It seems that array appending has changed wrt negative indices. I had just documented the new behaviour but now I'm not entirely sure whether I've just documented an unintentional change. Is this new behaviour what is desired (i.e.

Re: [PHP-DEV] Array broken in 5_2?

2007-06-22 Thread Zoe Slattery
Pierre wrote: Hi, If you run 'make test' using 5.2 (maybe head too, did not test), I get a lot of errors like: Notice: Undefined offset: 534 in /home/pierre/cvs/php52_dev/run-tests.php on line 1682 and obviously many tests fail. As far as I can tell, something have been broken recently. The

Re: [PHP-DEV] Array broken in 5_2?

2007-06-22 Thread Oliver Block
Am Freitag, 22. Juni 2007 14:41 schrieb Pierre: > Hi, > > If you run 'make test' using 5.2 (maybe head too, did not test), I get > a lot of errors like: > > Notice: Undefined offset: 534 in > /home/pierre/cvs/php52_dev/run-tests.php on line 1682 > > and obviously many tests fail. Not on my System

Re: [PHP-DEV] Array objects & array functions

2008-01-07 Thread Stanislav Malyshev
More specifically I was thinking of starting with adding an SPL interface called ArraySearchable, and modifying php_search_array in ext/standard/array.c to accept an object that implements that interface, in which case the appropriate interface method is called. What this interface would do? I

[PHP-DEV] Array map with reset function

2020-08-25 Thread Michael Voříšek - ČVUT FEL
The following code stopped working in PHP 8: https://3v4l.org/UlIE3 is it a bug or a feature? is posting issues like this to internals@lists.php.net email prefered over opening bug directly? or is there any special email for it? With kind regards / Mit freundlichen Grüßen / S přátelským p

[PHP-DEV] Array functions with strict comparison

2023-11-11 Thread Andreas Hennings
Hello internals, I noticed that array functions like array_diff(), array_intersect() etc use weak comparison. E.g. array_diff([0, '', false, null], [null]) only leaves [0]. This makes these functions useless for a number of applications. Also it can lead to unpleasant surprises, if a developer is

Re: [PHP-DEV] Array dereferencing of scalars

2015-06-08 Thread Stanislav Malyshev
Hi! > Would throwing a notice or a warning on array deferencing scalars > be acceptable for PHP 7.0, or does this need an RFC? I think this does need an RFC, and for 7.0, pretty much no new language changes are acceptable anymore, since we're past the timeframe. -- Stas Malyshev smalys...@gmail.

Re: [PHP-DEV] Array dereferencing of scalars

2015-06-09 Thread Yasuo Ohgaki
Hi all, On Tue, Jun 9, 2015 at 6:21 AM, Stanislav Malyshev wrote: > > Would throwing a notice or a warning on array deferencing scalars > > be acceptable for PHP 7.0, or does this need an RFC? > > I think this does need an RFC, and for 7.0, pretty much no new language > changes are acceptable an

Re: [PHP-DEV] Array dereferencing of scalars

2015-06-09 Thread Matt Wilmas
Hi all, - Original Message - From: "Yasuo Ohgaki" Sent: Tuesday, June 09, 2015 Hi all, On Tue, Jun 9, 2015 at 6:21 AM, Stanislav Malyshev wrote: > Would throwing a notice or a warning on array deferencing scalars > be acceptable for PHP 7.0, or does this need an RFC? I think this d

Re: [PHP-DEV] Array dereferencing of scalars

2015-06-09 Thread Yasuo Ohgaki
Hi Matt, On Tue, Jun 9, 2015 at 7:04 PM, Matt Wilmas wrote: > Hi all, > > > - Original Message - > From: "Yasuo Ohgaki" > Sent: Tuesday, June 09, 2015 > > Hi all, >> >> On Tue, Jun 9, 2015 at 6:21 AM, Stanislav Malyshev >> wrote: >> >> > Would throwing a notice or a warning on array d

Re: [PHP-DEV] Array dereferencing of scalars

2015-06-09 Thread Christoph Becker
Yasuo Ohgaki wrote: > I fully agree that current behavior could be used meaningful ways. However, > >$foo = 42; > $foo['bar']; // => NULL > $v = NULL; > $v[0][1][2][3][4][5][6][7][8][9]; // NULL > > this code is semantically wrong and I would like to have error/exception > for such > erro

Re: [PHP-DEV] Array dereferencing of scalars

2015-06-09 Thread Matt Wilmas
Hi all, - Original Message - From: "Christoph Becker" Sent: Tuesday, June 09, 2015 Yasuo Ohgaki wrote: I fully agree that current behavior could be used meaningful ways. However, NULL $v = NULL; $v[0][1][2][3][4][5][6][7][8][9]; // NULL this code is semantically wrong and I wou

Re: [PHP-DEV] Array dereferencing of scalars

2015-06-09 Thread Rowan Collins
Yasuo Ohgaki wrote on 09/06/2015 11:44: $v = NULL; $v[0][1][2][3][4][5][6][7][8][9]; // NULL this code is semantically wrong and I would like to have error/exception for such erroneous codes. PHP considers an uninitialised variable to have the value NULL, and a NULL value to be coercable

Re: [PHP-DEV] Array dereferencing of scalars

2015-06-09 Thread Christoph Becker
Matt Wilmas wrote: > Forgetting the NULL case for a sec... With: > > $v = []; > $v[0][1][2][3][4][5][6][7][8][9]; > > How/why are we going from 1 Notice to 10?! > > With: > > unset($v); > $v[0]; > > Why from 1 Notice about the undefined variable, to 2? That's totally > new, and it really do

Re: [PHP-DEV] Array dereferencing of scalars

2015-06-09 Thread Rowan Collins
Christoph Becker wrote on 08/06/2015 22:11: The behavior of dereferencing scalars as if they were arrays or strings is arguable: NULL A few things to note here: - accessing a *numeric* offset of a *string* is valid (selects a single character) - accessing a *string* offset of another str

Re: [PHP-DEV] Array dereferencing of scalars

2015-06-09 Thread Rowan Collins
Christoph Becker wrote on 09/06/2015 13:35: Current behavior: foo->bar; ?> Notice: Trying to get property of non-object in %s on line %d Notice: Trying to get property of non-object in %s on line %d So trying to access a property on NULL gives a notice, but trying to access an eleme

Re: [PHP-DEV] Array dereferencing of scalars

2015-06-09 Thread Christoph Becker
Rowan Collins wrote: > Yasuo Ohgaki wrote on 09/06/2015 11:44: >> $v = NULL; >> $v[0][1][2][3][4][5][6][7][8][9]; // NULL >> >> this code is semantically wrong and I would like to have error/exception >> for such >> erroneous codes. > > PHP considers an uninitialised variable to have the valu

  1   2   >