Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #7201
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | "M. Strobel" <sorry_no_mail_here@nowhere.dee> |
| Newsgroups | comp.lang.php |
| Subject | Re: Count how many times a value occurs in an array |
| Date | Thu, 27 Sep 2012 19:43:51 +0200 |
| Lines | 52 |
| Message-ID | <acjhinFap9pU1@mid.uni-berlin.de> (permalink) |
| References | <475e0b6d-5e6e-4a60-9ec8-21f068bc3913@googlegroups.com> <c8b9fe91-9d7b-4918-b910-835c50399743@h4g2000yqo.googlegroups.com> <5064339a$0$6841$e4fe514c@news2.news.xs4all.nl> <acjcjqF9iovU1@mid.uni-berlin.de> <42505440-8980-4772-85d5-303998824b62@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 7bit |
| X-Trace | news.uni-berlin.de bYDmgpIT3mAOOGs0+LJ6twRtx7w5ghPvnzndGUpc/jUS1G42reXBqL7XIDgBmqCvI= |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120825 Thunderbird/15.0 |
| In-Reply-To | <42505440-8980-4772-85d5-303998824b62@googlegroups.com> |
| Xref | csiph.com comp.lang.php:7201 |
Show key headers only | View raw
Am 27.09.2012 19:14, schrieb Ryan: > On Thursday, September 27, 2012 9:19:08 AM UTC-7, M. Strobel wrote: >> Am 27.09.2012 13:08, schrieb Erwin Moller: >> >>> On 9/27/2012 12:48 PM, Captain Paralytic wrote: >> >>>> On Sep 27, 7:25 am, Ryan <rbile...@gmail.com> wrote: >> >>>>> >> >>>>> jw if ph has a build in function to make this easy of am I going to have to roll >> >>>>> my own by looping though the array? >> >>>> >> >>>> Care to explain what the above is supposed to mean? >> >>>> >> >>> >> >>> jw probably means: Just wondering >> >>> ph probably means PHP >> >>> >> >> >> >> I hope (for him) the OP does not program the same way he is writing. >> >> >> >> /Str. > > Oh so will arra_count_values not work? lol that's what I get for typing tired. Fortunately for me my IDE will highlight any errors lol. > > On a more serious note though I have noticed one limitation. It will no go into sub arrays. So when I query my DB it will actually come up like this > > array (array(1), array(1), array (2)) ect. So what would be the best way to deal with this, is there a way to go though and clean it up by removing the nested arrays and replacing them with integers or even a literal string would work for me. > > I suppose if all else fails I could just loop though the primary array and implode each sub array. Yes you get an array of arrays from a database query. PHP has a ton of functions... let's see... I would use array_walk_recursive(). Be careful with call-by-reference, it is not allowed in the newest PHP versions. /Str.
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Count how many times a value occurs in an array Ryan <rbilesky@gmail.com> - 2012-09-26 23:25 -0700
Re: Count how many times a value occurs in an array aroniss@gmail.com - 2012-09-27 00:10 -0700
Re: Count how many times a value occurs in an array Captain Paralytic <paul_lautman@yahoo.com> - 2012-09-27 03:48 -0700
Re: Count how many times a value occurs in an array Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-09-27 13:08 +0200
Re: Count how many times a value occurs in an array "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-09-27 18:19 +0200
Re: Count how many times a value occurs in an array Ryan <rbilesky@gmail.com> - 2012-09-27 10:04 -0700
Re: Count how many times a value occurs in an array Ryan <rbilesky@gmail.com> - 2012-09-27 10:14 -0700
Re: Count how many times a value occurs in an array "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-09-27 19:43 +0200
Re: Count how many times a value occurs in an array Christoph Becker <cmbecker69@gmx.de> - 2012-09-27 20:07 +0200
Re: Count how many times a value occurs in an array "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-09-27 23:52 +0200
Re: Count how many times a value occurs in an array Christoph Becker <cmbecker69@gmx.de> - 2012-09-28 00:07 +0200
array_walk() callback Was: Count how many times a value occurs in an array "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-09-28 10:04 +0200
Re: Count how many times a value occurs in an array Jerry Stuckle <jstucklex@attglobal.net> - 2012-09-27 18:26 -0400
Re: Count how many times a value occurs in an array Captain Paralytic <paul_lautman@yahoo.com> - 2012-09-28 07:35 -0700
Re: Count how many times a value occurs in an array Christoph Becker <cmbecker69@gmx.de> - 2012-09-28 17:40 +0200
csiph-web