- HubPages»
- Technology»
- Computers & Software»
- Computer Science & Programming»
- Programming Languages
PHP Code Example on Numeric Array
PHP code sample, php scripts sample, a php code example on Numeric array
Arrays is very important in every programming languages. Hence, the arrays in php play also an important rule to php programmer epeciallly when they deal series of data's. This hub contains a php code example on numeric array.
Note: Before you can test and run this php code example, you should know how to run a php file on your browser. The link below would give you the details on how to run a php file and the requirements on running a php code/scripts or file.
How to run a PHP file on your Browser Using XAAMP and Notepad++
Please save the following code as numericalarray.php
PHP Code Example on Numerical Array
<?php $student = array("J. Parker", "N. Smith", "M. Maclein", "A. Garfield", "R. Rutherford"); $count = count($student); echo "<strong>The students in the Array are: </strong>". "<br/><br/>"; for($i=0; $i<$count; $i++) { echo $student[$i]. "<br /> "; } ?>
Sample Output on numericalarray.php
Do you want to test the code? For the sake of clarification, here is how to test the above code intended only for beginners:
1. Be sure that you installed XAAMP and Notepad++.
2. Open the Xaamp application and run the Apache and My SQL on the Xaamp Window.
3. Copy the code above in your notepad++ and save it to the drive where you installed the Xaamp, open the Xaamp folder on that drive and open the htdocs folder. On the htdocs folder where you will save the php file, better name it whileloop.php.
4. Now, go to your browser and type this: localhost/numericalarray.php. As soon as you hit enter, you will be directed similar to the sample output above.
Other PHP Code Examples and Tutorials
- How to become a PHP Developer: Learn and Earn
- Steps on How to Program in PHP: A Beginner's Guide on PHP Programming-Part 1
- How to run PHP Code or PHP Scripts and See the Result on Your Browser
- HTML Basics: Learn The Basics of HTML and Create Your Own Webpage on Your Browser
- PHP Sample Codes On Function:How to make Function in PHP
- PHP Code Example on Associative Array and Multidimensional Array
- PHP Code Example on Switch Statement:Making Choice and Cases
- PHP code Example for if statement
- PHP Code Example for if-else Statement With Notepad++
- PHP Code Example on if else-if Statement
- PHP Code Example on While Loop
- PHP Code Example on Do-while Loop
- PHP Code Example on Foreach Loop and For Loop