Looking for a Tutor Near You?

Post Learning Requirement »
x

Choose Country Code

x

Direction

x

Ask a Question

x

x
x
x
Hire a Tutor

Introduction To PHP

Loading...

Published in: PHP And MySQL
1,016 Views

PHP stands for Hypertext Preprocessor. These notes give a slight introduction to PHP.

Neelam S / Ghaziabad

1 year of teaching experience

Qualification: B.Tech

Teaches: Basic Computer, MS Office, School Level Computer, Computer Science, IT & Computer Subjects, Chemistry, Mathematics, Social Studies, CSS Training, HTML Training, PHP And MySQL

Contact this Tutor
  1. Class 6 Arrays: i. iii. An array is a data structure that stores one or more similar type of values in a single value. For example if you want to store 100 numbers then instead of defining 100 variables its easy to define an array of 100 length. There are three different kind of arrays Numeric array An array with a numeric index. Values are stored and accessed in linear fashion. Associative array An array with strings as index. This stores element values in association with key values rather than in a strict linear index order. Multidimensional array An array containing one or more arrays and values are accessed using multiple indices Numeric Array: < ?php / * First method to create array. */ $numbers = array( 1, 2, 3, 4, 5); foreach( $numbers as $value ) echo "Value is $value
  2. < ?php / * First method to associate create array. */ $salaries = array("rahul" 2000, "akshay" 1000, "akhll • 500); echo "Salary of rahul is ". $salaries['rahul'] . "
  3. "akhil" array "physics" 31, "maths" 22, "chemistry" 39 / * Accessing multi-dimensional array values */ echo "Marks for rahul in physics echo $marks['rahul']['physics'] . "
  4. iii. Sort associative arrays in ascending order, according to the value (asort()) For example: < ?php $myArray = array("el " "Bike", "e2" "Car", "e3" "Anchor"); asort($myArray); foreach($myArray as $key $value) { echo "$key - $value "; iv. Sort associative arrays in ascending order, according to the key (ksort()): " , "Car For example: < ?php $fruits = array("d"=>"lemon", ksort($fruits); foreach ($fruits as $key $val) { echo "$key = $val\n" "b"=>"banana", " apple"); v. Sort associative arrays in descending order, according to the value (arsort())•, For example: < ?php $myArray = array("el " "Anchor e2 arsort($myArray); foreach($myArray as $key $value) { echo "$key - $value
  5. N/A