JavaScript Arrays

Arrays are extremely useful for storing and manipulating information in any language.The array is one of a number of objects built directly into JavaScript. Think of them simply as variables containing multiple values. An array is a variable that can store many variables within it.In javascript arrays are same like other languages.

Values in a javascript array are accessed same as we access in php.
1.Using position (exe. myArray[2])

Creating a JavaScript Array

<script type=”text/javascript”>
<!–
var myArray = new Array();

myArray[0] = “Football”;
myArray[1] = “Baseball”;
myArray[2] = “Cricket”;

alert(myArray[0] + myArray[1] + myArray[2]);
//–>
</script>

Read the rest of this entry »

Sessions in php

I always try to provide good information to beginners in php because these small looking problems may be big problem for a beginner. Session are one of them.
We use sessions when we get to a stage where our website need to pass along user data from one page to another.

A normal HTML website will not pass data from one page to another. In other words, all information is forgotten when a new page is loaded. This makes it quite a problem for tasks like a shopping cart, which requires data(the user’s selected product) to be remembered from one page to the next.

Using session you can send information between one page to another.However, this session information is temporary and is usually deleted very quickly after the user has left the website that uses sessions. Sessions work by creating a unique identification(UID) number for each visitor and storing variables based on this ID. This helps to prevent two users’ data from getting confused with one another when visiting the same web page.

Read the rest of this entry »

Arrays in php

Arrays are always a big and typical topic for php beginners.Some times they left their job because of arrays.I was also one of them .But after a long experience now i understand that arrays are too easy in php like eating food because php has allready provided readymade funda for arrays .You just have to use that logic and nothing else.

An array in PHP is a collection of values. Like A mapĀ  that associates values to keys. In an array each values associate to an Unique key and you can access valuse by using that key. As array values can be other arrays, trees and multidimensional arrays are also possible.

Read the rest of this entry »