Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Introduction to php 6

368 views

Published on

PHP is a relatively easy language to learn if you are familiar with HTML/CSS. Here, and following, are the presentations to familiarize yourself with PHP/MySQL and HTML Basics.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Introduction to php 6

  1. 1. Technical Team, PC Technology Private Limited Introduction to PHP/MySQL
  2. 2. What has been covered?  PHP Conditional Statement  If Statement  If-else Statement  If-elseIf-else Statement  Switch Statement  Loop Statements  For Loop  While Loop  Do While Loop  Practice Questions
  3. 3. What is an Array ?  An array stores multiple values in one single variable.  The values of arrays can be accessed by using their position in the array.  Example <?php $tech = array(“Java", “Net", “PHP"); echo "I like “. $tech[0].", “. $tech[1]." and “.$tech[2]."."; ?>
  4. 4. What can an array do ?  Array acts like a special variable  It can hold more than one value at a time  The location of the array is also called an index number  The first value in the array holds the index number 0  The array( ); function is used to declare an array
  5. 5. Types of arrays  There are three types of arrays  Indexed Array  Associative Array  Multi-Dimensional Array
  6. 6. Indexed Arrays  In indexed arrays, a particular index is assigned to the value automatically  Declaration $tech= array(“Java", “NET", “PHP"); $ tech] = " Java "; $ tech] = " NET "; $ tech] = " PHP ";
  7. 7. Associative Arrays  Rather than using index keys, we use name keys to associate a particular value.  Declaration : $age = array(“Virat"=>“28", “Dhoni"=>“36", “Sachin"=>“41"); $age[Virat'] = “28"; $age[‘Dhoni'] = “36"; $age[‘Sachin'] = “41"; <?php $age = array(“Virat"=>“28", “Dhoni"=>“36", “Sachin"=>“41"); foreach($age as $x => $x_value) { echo "Key=" . $x . ", Value=" . $x_value; echo "<br>"; } ?>
  8. 8. PHP Sort Function for Arrays  sort() - sort arrays in ascending order  rsort() - sort arrays in descending order  asort() - sort associative arrays in ascending order, according to the value  ksort() - sort associative arrays in ascending order, according to the key  arsort() - sort associative arrays in descending order, according to the value  krsort() - sort associative arrays in descending order, according to the key

×