PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Is there any way, preferably without loops, that I can feed in a number, for example 15, and the array will return the value of the first key that is equal to or less than 15?
That's because I believe it's made to search for exactly what it says, the previous key than the key you entered
So if you have an array like 10, 15, 20... and you enter 15, you need to modify that snippet in order for it to search for anything below 15 instead of 14 like it does now.
m3mn0n wrote:That's because I believe it's made to search for exactly what it says, the previous key than the key you entered
So if you have an array like 10, 15, 20... and you enter 15, you need to modify that snippet in order for it to search for anything below 15 instead of 14 like it does now.
Which means a loop, doesn't it? Just what I was trying to avoid.