Home > Backend Development > PHP Tutorial > Small example of php each() function

Small example of php each() function

WBOY
Release: 2016-07-25 08:56:17
Original
859 people have browsed it
  1. //Learn how to use each() function

  2. $prices=Array('Tries' => 100, 'Oil' => 10, 'Spank Plugs' => 4)

  3. while($elements = each($prices)){

  4.  echo $elements['key']; //echo $elements[0];
  5.  echo " - ";
  6.  echo $elements['value']; //echo $element[1];
  7.  echo "
    ";
  8. }

Copy code

Output results : Tires-100 Oil-10 Spank Plugs-4



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template