PHP Knowledge

  • what is PHP

  • What is PHP class
  • Smarty PHP
  • PHP Calendar

  • PHP delete
  • PHP count

  • PHP Directory
  • php echo
  • php exec
  • PHP explode
  • PHP fopen

  • PHP Form
  • PHP get

  • PHP If
  • PHP list
  • php login
  • PHP LOOP
  • PHP Random
  • PHP Redirect
  • PHP replace
  • PHP session
  • PHP sort
  • PHP split
  • php substr
  • PHP Syntax
  • PHP time

  • PHP upload
  • php URL
  • PHP version
  • PHP Cookie
  • PHP Global
  • php LDAP
  • PHP list
  • php strip
  • PHP template
  • php PEAR
  • PHP md5
  • PHP ini
  • PHP FTP
  • More others

    Javascript
    CSS
    PHP

     

    PHP list


    PHP list() Function

     

    PHP list Definition and Usage

    The list() function is used to assign values to a list of variables in one operation.

    PHP list Syntax

    list(var1,var2...)

    Parameter

    Description

    var1

    Required. The first variable to assign a value to

    var2

    Optional. More variables to assign values to

    PHP list Tips and Notes

    Note: This function only works on numerical arrays.

    PHP list Example 1

    <?php $my_array = array("Dog","Cat","Horse");

    list($a, $b, $c) = $my_array;

    echo "I have several animals, a $a, a $b and a $c."; ?>

    The output of the code above will be:

    I have several animals, a Dog, a Cat and a Horse.

     

    PHP list Example 2

    <?php $my_array = array("Dog","Cat","Horse");

    list($a, , $c) = $my_array;

    echo "Here I only use the $a and $c variables."; ?>

    The output of the code above will be:

    Here I only use the Dog and Horse variables.

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

  • Javascript |