php tutorial - PHP Datatypes Array - php programming - learn php - php code - php script




  • php array stores several values in one single variable.
  • php array in PHP is actually an ordered map.
  • A map is a type that maps values to keys.
php - php 7 - php tutorial - php framework tutorial - php examples - php sample code - php basics - php web development - php components - php project - php technology  - learn php - php online - php programming - php program - php code - html code - embedded php in html - web server  - php syntax - php function - variable types

php array code Syntax :

<?php
    $arrayname = array("array1","array2","array3");
?>
click below button to copy the code. php tutorial - team

learn php Sample Code : a simple php program

<!DOCTYPE html>
<html>
    <head>
        <title>Datatype-Array</title>
    </head>
    <body>
        <?php
            $wikitechy = array("welcome","wikitechy","Arrays");
	    var_dump($wikitechy);
        ?>
    </body>
</html>
click below button to copy the code. php tutorial - team

array php examples Code Explanation :

Code Explanation for Datatype Array In PHP

  1. ($wikitechy) holds the values in a php array as array("welcome","wikitechy","Arrays").
  2. Now we need to print the first element of an array.

      1. First, we pass variable($wikitechy) name with index value[0], that fetchs the first element corresponding to the index value. Output will be welcome.
      2.Next pass variable($wikitechy) name with index value[1], that fetchs the second element corresponding to the index value. Output will be wikitechy.
      3.Next pass variable($wikitechy) name with index value[2],that fetchs the third element corresponding to the index value. Output will be Arrays.
  3. var_dump($wikitechy); this var_dump() function returns the data type and its values.

php tutorials Sample Output :

output1 for Datatype Array In PHP

output2 for Datatype Array In PHP

  1. array(3) represents the 3 types of php array names i.e. “welcome","wikitechy","Arrays".
  2. Here in this output, for the 0th array index, the var_dump returns the datatype string with its value welcome which has 7 characters.
  3. Here in this output, for the 0th array index, the var_dump returns the datatype string with its value welcome which has 7 characters.
  4. For the 1st array index, the var_dump returns the datatype string with its value wikitechy which has 9 characters.
  5. For the 2nd array index, the var_dump returns the datatype string with its value Arrays which has 6 characters.


Related Searches to php datatype array

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×