Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #18390
| From | alex <1j9448a02@lnx159sneakemail.com.invalid> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: value returned instead change the value of the variable |
| Date | 2020-10-17 09:26 +0200 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <rme6c1$g04$1@gioia.aioe.org> (permalink) |
| References | <rmbvqm$lnh$1@gioia.aioe.org> <huu8d0Ft5ceU1@mid.individual.net> |
Il 16/10/20 20:51, J.O. Aho ha scritto: > If you prompt want an array, either you make it to one afterwards or > store the values as single cell arrays in the main array > > Alt 1: > array(array_shit($arr)); > > Alt 2: $arr = [[1],[2]]; ???? But what do I need? >> // DESIGN 2 >> echo "It works, but I don't like 'DESIGN 2': "; >> $arr = [1, 2]; >> array_shift($arr); >> print_r( >> $arr >> ); >> >> Output: >> >> It works, but I don't like 'DESIGN 2': Array >> ( >> [0] => 2 >> ) > > Sure we compare apples and oranges, the $arr will be an array even if > you shift out the last value from it. > > try this: > > $arr = [1, 2]; > array_shift($arr); > print_r($arr); > array_shift($arr); > print_r($arr); > echo "This will confuse you even more\n"; > print_r(array_shift($arr)); > > So what?
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
value returned instead change the value of the variable alex <1j9448a02@lnx159sneakemail.com.invalid> - 2020-10-16 13:23 +0200
Re: value returned instead change the value of the variable Jerry Stuckle <jstucklex@attglobal.net> - 2020-10-16 11:11 -0400
Re: value returned instead change the value of the variable alex <1j9448a02@lnx159sneakemail.com.invalid> - 2020-10-16 18:36 +0200
Re: value returned instead change the value of the variable "J.O. Aho" <user@example.net> - 2020-10-16 20:51 +0200
Re: value returned instead change the value of the variable alex <1j9448a02@lnx159sneakemail.com.invalid> - 2020-10-17 09:26 +0200
Re: value returned instead change the value of the variable "J.O. Aho" <user@example.net> - 2020-10-17 10:16 +0200
csiph-web