Jump to content

Recommended Posts

what's up php freaks. This is my first post in this forum and I am a newb at PHP(just started reading and toying with php about 2 weeks ago).

 

I've been developing static,boring websites for a year now and want to make them a little more dynamic and a friend of mine recommended me learning php.it's been a nightmare ever since lol but I am hooked on learning this program and would like to conquer it if possible.

 

Currently, I am working on building my first dynamic website and my question is this....

 

I want to use numbers from 200 to 1000 and want to put it in an array. Now I know how to do arrays,but I wanted to know if it's possible to shorten up the numbers in the arrays say for example like $array = array(200-300, 301 - 600, 601-800, 801-1000)and still have each individual number function properly instead of manually having to enter each number in the array without affecting the numbers when a user types it in? say for example a user wants to type 223 and gets the result with no problems.

 

It just seems sloppy coding for me to have to manually enter each number in the array. I hope this post makes sense and hopefully get some responses.

 

Thanks,

 

cleverly "not so" slick

 

 

so you want the numbers 200-1000 in a array? dont hand type it thats the manual way use a while loop or for loop

 

Thanks dad00, that's exactly what I was looking for

 

 

 

 

It always pays to browse the documentation first for answers to basic "can php/how to do this in php" questions - http://www.php.net/manual/en/function.range.php

 

Thanks for the reference PF I will be sure to read through this site. appreciate the quick responses.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.