I took me some considerable time to work out what was going wrong.
I had been trying to use the array_rand function to gather a random selection of images to display, each of which to be referenced with a number string prefixed with a "/" slash, for example "/106".
The trouble then turned out to be that the array_rand function, for whatever reason best known to itself, returns the requisite assorttment of selected values, but with the slashes all stripped from the returned result, with the "/106" for instance returned as a mere "106".
This was easy enought to fix, as soon as the unexpected result was detected as the reason for the failure to achieve the expected result. It works fine with the array_keys function used to extract an array of keys to use as a proxy, in order then to extract from the keys array to reference in turn the original array.
I am raising the subject here to warn of the unfortunate possibility, and to wonder if anybody has any insight to offer as to why the slashes would be stripped off to begin with, and if therfore this might happen with other cases. I had rather hoped that including the slashes would tend to make sure that the array values would not be treated as scalar values, but perhaps the effect is rarther the opposite, that they persuade the array_rand function to treat them in this particular fashion.
I had thought that perhaps the function was trying to divide by the value, except that 0 divided by 106 should be 0, not 106.
-- RH.
0 999 Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jordan Rastrick |
last post by:
First, a disclaimer. I am a second year Maths and Computer Science
undergraduate, and this is my first time ever on Usenet (I guess I'm
part of the http generation). On top of that, I have been...
|
by: Abdullah Kauchali |
last post by:
Hi folks,
Can one rely on the order of keys inserted into an associative Javascript
array? For example:
var o = new Object();
o = "Adam";
o = "Eve";
|
by: Pavils Jurjans |
last post by:
Hello,
I have bumped upon this problem: I do some client-side form processing
with JavaScript, and for this I loop over all the forms in the
document. In order to identify them, I read their...
|
by: Alvey Sidecast |
last post by:
Well it is to me anyway.
------------------------------
Access Version = 2002
OS = XP Pro
User = Ordinary to bumbling
------------------------------
I was writing some sql yesterday which...
|
by: PeteCresswell |
last post by:
I was happily coding along, putting some calculation results (rolling
annualized rates of return - too compute-intensive to calculate
on-the-fly - had tb staged beforehand via a batch job) into...
|
by: mdh |
last post by:
In one of the answers to a K&R exercise, the first couple of lines are:
enum loop { NO, YES};
enum loop okloop=YES;
I get the first line, but not the second.
Sorry about the LOL question.
...
|
by: jht5945 |
last post by:
For example I wrote a function:
function Func()
{
// do something
}
we can call it like:
var obj = new Func(); // call it as a constructor
or
var result = Func(); // call it as...
|
by: mai |
last post by:
Hi everyone,
i'm trying to exhibit FIFO anomaly(page replacement algorithm),, I
searched over 2000 random strings but i couldnt find any anomaly,, am
i I doing it right?,, Please help,,,The...
|
by: Lazandra |
last post by:
Hi guys
I'm trying to display one database entry randomly. So i have used array_rand(). However i have completely confused myself, and close to hitting my monitor with a tree branch.
This is...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |