Posts

PHP foreach statement

PHP foreach statement works on PHP array by which we can reach every elements of an array. For example, we have an array like $array(10,20,30,40), we want to print each element of that array. In this kind of case that means in PHP array we use PHP foreach statement. Now take a look at the structure of PHP foreach statement. foreach($array as $value) { code to be executed; } In the foreach statement at first we use the actual array and then we use a temporary variable which is used to store the array elements. foreach statement example Now I am trying to provide an example. Think that we have an array that contains number 1,2,3,4,5 . So now try to print each array value using PHP. <?php $number=array(1,2,3,4,5); foreach($number as $value ) {     echo $value;     } ?> In the above code we just print the each value of this array. Now we try to print something based on condition. So now take a look at the example. <?php $number=array(1,2,3,4,5); foreac...

PHP continue statement

PHP continue statement and break statement are identical but the only difference is PHP continue statement just skip the current iteration and continue execute other iteration inside loop. We can use continue statement in PHP iteration statement such as for loop, while loop and do-while loop.  We can define PHP continue statement by using if statement such as if(condition) continue;   If the condition is true then the continue statement is executed.  Now we consider an example to understand the PHP continue statement. PHP continue statement example: <?php for($count=0; $count<=10; $count++) { if($count==5) continue; echo $count; } In this example after if condition we use continue statement. So this program not print 5 because for continue statement. The output look like this where 5 is missing 1234678910

PHP break statement

We use two jump statement in PHP such as break statement and continue statement. Break means stop. So PHP break statement stop the program execution based upon condition. We use PHP break and continue statement to control the loop or program flow. PHP break and continue statement is totally different from each others. If we found PHP break statement inside a loop then the loop will stop the execution and the loop will be terminated. So we can say that if PHP break statement is available in the loop then the loop won't work by comparing specific condition. In the condition part we use if statement and then we set break statement. PHP break statement Structure: if(condition) break; In this code at first we use a condition, if the condition is true then the break statement is executed and it terminate or jump the program. PHP break statement example:  Now consider an example using PHP. In this example we use for loop but you can use break statement in any kind of loop ...

PHP control statements

We need to control PHP code based upon different condition for example, if the user click on the registration button, then a registration form will show to the users. To control the PHP code we use different types of PHP control statement such as if, else, for loop, break etc. PHP control statement has been broken into three types of category.  PHP selection statement PHP iteration statement PHP jump statement From those statements, using PHP selection statement we can easily select different types of PHP code based upon condition. We can divide the PHP selection statement into two parts  PHP if statement  PHP switch statement  Using PHP iteration statement we can repeat PHP code based upon condition. We can divide PHP iteration statement into three types PHP for loop PHP while loop  PHP do-while loop  Using PHP jump statement we can break PHP condition and we can jump one code snippet to another code snippet. PHP jump statements are two types PHP break sta...

ZAMPP installation

Image
In our previous tutorial we saw how to install Vertrigo web server , today I will describe how to install XAMPP web server in your local computer. XAMPP is a very powerful software that provides integrated PHP environment. To create PHP environment we need Apache, PHP, MySQL but XAMPP consolidate those three things. So follow the following steps to install ZAMPP in your computer as a server.   ZAMPP Installation Procedure I divided the installation procedure into three steps. Step 1:  We can install ZAMPP in two ways, one is manually and second one is through installer. In this section we try to install XAMPP manually. To do this, at first you need to download ZAMPP from ZAMPP DOWNLOAD . Step 2:  After downloading the file, extract the downloaded file. After extracting the file you need to choose where you want to install XAMPP such that I want to install ZAMPP in D folder. So put your extracted file in D folder. Double click on Setup_xampp.bat. Now click on xampp-contr...

Vertrigo server installation

Image
Before installing Vertrigo server we try to know something about Vertrigo web server. Vertrigo is a software system that provides PHP environment with one step installation. This integrated software provides Apache, PHP, MySQL and PhpMyAdmin in integrated way. If you install vertrigo web server in your computer then it will creates PHP environment in your computer as a local server. So let's try to install vertrigo web server with us.  Vertrigo Server Installation Procedure: Step 1: First of all download the latest version of vertrigo web server from this link Download Vertrigo . To download the latest version click on GET THE LATEST VERSION . Step 2:  After download, double click on that file and then click next, then click on I agree. Then select the destination folder such that I select D folder like the picture. Step 3:   Install the software by clicking next. Your work is done. You will see a Vertrigo server icon in your desktop. Double click on this icon and the s...

PHP installation

We know PHP run on server, that's why at first we need to create PHP environment in our local computer. To do this we need to install PHP and a web server. So we say that to create PHP environment we need two things  PHP (Apache) Web Server   At first we install PHP (Apache) and then we install web server. This installation process is very complex. Now a days there are various types of software provides integrated capability, that means we need to install only one software to create PHP environment. Some software are XAMPP, WAMPP, Vertrigo etc.   In our tutorial we will show you how to install XAMPP and Vertrigo in your local computer. I like vertrigo web server and though in our whole tutorial I will use Vertrigo web sever but you can use XAMPP server. XAMPP server is very useful and popular web server for the PHP developers. So guys install one software among them ( ZAMPP or Vertrigo). If you already installed PHP environment just skip this installation process. X...