Get latest news and Web Designing tutoria

Saturday, 30 May 2015

PHP Arrays

You know what a variable is – just a storage area where you hold numbers and text. The problem is, a variable will hold only one value. You can store a single number in a variable, or a single string. An array is like a special variable, which can hold more than one number, or more than one string, at a time. If you have a list of items (like a list of customer orders, for example), and you need to do something with them, then it would be quite cumbersome to do this:
$Order_Number1 = "Black shoes";

$Order_Number2 = "Tan shoes";
$Order_Number3 = "Red shoes";
$Order_Number4 = "Blue shoes";
What if you want to loop through your orders and find a specific one? And what if you had not four orders but four hundred? A single variable is clearly not the best programming tool to use here. But an array is! An array can hold all your orders under a single name. And you can access the orders by just referring to the array name.

Related Posts:

  • PHP and the Action Attribute of HTML Forms The Action attribute is crucial. It means, "Where do you want the form sent?". If you miss it out, your form won't get sent anywhere. You can send the form data to another PHP script, the same PHP script, an email … Read More
  • HTML Forms and PHP If you know a little HTML, then you know that the FORM tags can be used to interact with your users. Things that can be added to a form are the likes of text boxes, radio buttons, check boxes, drop down lists, text are… Read More
  • PHP Booleans A Boolean value is one that is in either of two states. They are known as True or False values, in programming. True is usually given a value of 1, and False is given a value of zero. You set them up just like other va… Read More
  • PHP and the Method Attribute of HTML Forms <FORM NAME ="form1" METHOD =" " ACTION = ""> The Method attribute is used to tell the browser how the form information should be sent. The two most popular methods you can use are GET and POST. But our METHOD… Read More
  • PHP and the Post Attribute of HTML Forms <FORM NAME ="form1" METHOD ="POST" ACTION = ""> The ?Submit1=Login part from the previous section is now gone! That is because we used POST as the method. Using POST means that the form data won't get … Read More

0 comments:

Post a Comment