Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #13200
| Message-ID | <2936930.zkYQ50mGB4@PointedEars.de> (permalink) |
|---|---|
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
| Organization | PointedEars Software (PES) |
| Date | 2014-03-17 16:07 +0100 |
| Subject | Re: Filling an array with random input doesn't quite work |
| Newsgroups | comp.lang.php |
| References | (1 earlier) <nOiVu.15756$eq5.3796@fx24.am4> <lg5lto$743$1@dont-email.me> <2014031712434095253-usenet@moojuicenet> <1701209.hILuKnBK3U@PointedEars.de> <2014031713471617567-usenet@moojuicenet> |
Gabe wrote:
> On 2014-03-17 13:32:57 +0000, Thomas 'PointedEars' Lahn said:
>> Gabe wrote:
>> ^^^^
>>> My code can be trivially modified to do this:
>>>
>>>
>>> $arr = array_fill(0, 40, 'http://mroldies.net/audio/19%u/%u-%03u.mp3');
>>> array_walk($arr, function(&$v, $k) { $yr = rand(60, 69); $v =
>>> sprintf($v, $yr, $yr, rand(1, 100)); });
>>>
>>>
>>> Will yield the following array which I have cut short to reduce noise:
>>>
>>> print_r($arr);
>>> Array
>>> (
>>> [0] => http://mroldies.net/audio/1966/66-007.mp3
>>> [1] => http://mroldies.net/audio/1967/67-021.mp3
>>> [2] => http://mroldies.net/audio/1962/62-016.mp3
>>> […]
>>> )
>>
>> Which *still* is _not_ what was asked for, which is (for whatever reason)
>> keys from _1_ to _40_ inclusive.
>>
>> It is also less than optimal to store the repeating prefix in the array,
>> but you might only have gotten the idea that this was wanted from the
>> precursor.
>>
>>> Each person prefers their own solution and I am no different. I prefer
>>> mine because I find it readable whilst only requiring two lines, of
>>> course you could add a few more line breaks in if preferable. […]
>>
>> You are missing the point.
>>
>>
>> PointedEars
It is impolite to full-quote a posting, particularly to quote the signature
of a posting without referring to it. Learn to quote.
> Dear PointedEars
You are confusing this with private e-mail.
> I am so sorry - I sometimes assume that people (on a PHP dev mailing
> list)
This is not a mailing list, it is a Usenet newsgroup. But it makes no
significant difference in that regard:
> would be able to make very basic adjustments to snippets that I
> posted to accommodate for discrepencies.
You have posted *twice* now something that fails to address the problem at
hand. You have been notified of that twice now. You have posted a
correction that is suboptimal, and you have been notified of that. And you
of all people dare to patronize others? Go away.
> I take it you are not one and have not programmed PHP before and are just
> looking to get started.
I have more than 14 years of professional experience in software development
with PHP now.
> Allow me to show you how to make such a change in order to produce an
> array index 1 to 40 inclusive… […]
If you cared to read, *I* know how it is done.
Score adjusted
PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Back to comp.lang.php | Previous | Next — Previous in thread | Find similar | Unroll thread
Filling an array with random input doesn't quite work richard <noreply@example.com> - 2014-03-12 13:18 -0400
Re: Filling an array with random input doesn't quite work Tim Streater <timstreater@greenbee.net> - 2014-03-12 17:36 +0000
Re: Filling an array with random input doesn't quite work Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-03-12 19:02 +0000
Re: Filling an array with random input doesn't quite work Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-03-12 19:06 +0000
Re: Filling an array with random input doesn't quite work Denis McMahon <denismfmcmahon@gmail.com> - 2014-03-12 20:34 +0000
Re: Filling an array with random input doesn't quite work Tim Streater <timstreater@greenbee.net> - 2014-03-12 22:51 +0000
solved! Re: Filling an array with random input doesn't quite work (was: Filling an array with random input doesn't quite work) richard <noreply@example.com> - 2014-03-12 17:08 -0400
Re: solved! Re: Filling an array with random input doesn't quite work (was: Filling an array with random input doesn't quite work) Tim Streater <timstreater@greenbee.net> - 2014-03-12 22:49 +0000
Re: solved! Re: Filling an array with random input doesn't quite work Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-13 01:11 +0100
Re: solved! Re: Filling an array with random input doesn't quite work richard <noreply@example.com> - 2014-03-12 22:43 -0400
Re: solved! Re: Filling an array with random input doesn't quite work Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-14 23:23 +0100
Re: solved! Re: Filling an array with random input doesn't quite work Christoph Michael Becker <cmbecker69@arcor.de> - 2014-03-14 23:58 +0100
Re: solved! Re: Filling an array with random input doesn't quite work richard <noreply@example.com> - 2014-03-12 21:14 -0400
Re: solved! Re: Filling an array with random input doesn't quite work (was: Filling an array with random input doesn't quite work) Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-03-13 02:50 +0000
Re: solved! Re: Filling an array with random input doesn't quite work (was: Filling an array with random input doesn't quite work) Denis McMahon <denismfmcmahon@gmail.com> - 2014-03-13 16:23 +0000
Re: solved! Re: Filling an array with random input doesn't quite work (was: Filling an array with random input doesn't quite work) Doug Miller <doug_at_milmac_dot_com@example.com> - 2014-03-13 02:53 +0000
Re: Filling an array with random input doesn't quite work Norman Peelman <npeelman@cfl.rr.com> - 2014-03-12 23:02 -0400
Re: Filling an array with random input doesn't quite work Jerry Stuckle <jstucklex@attglobal.net> - 2014-03-12 23:11 -0400
Re: Filling an array with random input doesn't quite work Norman Peelman <npeelman@cfl.rr.com> - 2014-03-14 09:31 -0400
Re: Filling an array with random input doesn't quite work Jerry Stuckle <jstucklex@attglobal.net> - 2014-03-14 11:00 -0400
Re: Filling an array with random input doesn't quite work Norman Peelman <npeelman@cfl.rr.com> - 2014-03-14 11:47 -0400
Re: Filling an array with random input doesn't quite work Jerry Stuckle <jstucklex@attglobal.net> - 2014-03-14 12:55 -0400
Re: Filling an array with random input doesn't quite work Norman Peelman <npeelman@cfl.rr.com> - 2014-03-14 23:10 -0400
Re: Filling an array with random input doesn't quite work Norman Peelman <npeelman@cfl.rr.com> - 2014-03-13 00:31 -0400
Re: Filling an array with random input doesn't quite work Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2014-03-14 12:42 -0700
Re: Filling an array with random input doesn't quite work Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-14 23:07 +0100
Re: Filling an array with random input doesn't quite work Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-03-15 21:32 +0000
Re: Filling an array with random input doesn't quite work Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-15 23:14 +0100
Re: Filling an array with random input doesn't quite work Jerry Stuckle <jstucklex@attglobal.net> - 2014-03-15 22:14 -0400
Re: Filling an array with random input doesn't quite work Ben Bacarisse <ben.usenet@bsb.me.uk> - 2014-03-16 02:51 +0000
Re: Filling an array with random input doesn't quite work Jerry Stuckle <jstucklex@attglobal.net> - 2014-03-16 09:46 -0400
Re: Filling an array with random input doesn't quite work Gabriel Dragffy <usenet@moojuice.net> - 2014-03-16 14:45 +0000
Re: Filling an array with random input doesn't quite work Norman Peelman <npeelman@cfl.rr.com> - 2014-03-16 19:52 -0400
Re: Filling an array with random input doesn't quite work Denis McMahon <denismfmcmahon@gmail.com> - 2014-03-17 02:16 +0000
Re: Filling an array with random input doesn't quite work Gabe <usenet@moojuice.net> - 2014-03-17 12:43 +0000
Re: Filling an array with random input doesn't quite work Jerry Stuckle <jstucklex@attglobal.net> - 2014-03-17 08:52 -0400
Re: Filling an array with random input doesn't quite work Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-17 14:32 +0100
Re: Filling an array with random input doesn't quite work Gabe <usenet@moojuice.net> - 2014-03-17 13:47 +0000
Re: Filling an array with random input doesn't quite work Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2014-03-17 16:07 +0100
csiph-web