Home | | Computer Application 12th Std | PHP - Create and Execute Variables

Practical Experiments | Computer Applications - PHP - Create and Execute Variables | 12th Computer Applications : Practical Experiments

Chapter: 12th Computer Applications : Practical Experiments

PHP - Create and Execute Variables

To create and execute a PHP Variables Example program

PHP - Create and Execute Variables

 

AIM

To create and execute a PHP Variables Example program

 

Procedure

1. Start Xampp server (Apache)

2. Goto virtual path folder (C:\xampp\htdocs)

3. Create Variable.php file and type the program

4. Execute the program on your Web browser using by this URL link (http://localhost/ Variable.php)

 

PROGRAM

            <html>

            <body>

            <?php

            $a = 25; // Numerical variable

            $b = “Hello”; // String variable

            $c = 5.7; // Float variable

            echo ‚Number is : “.$a.‚<br/>”;

            echo ‚String is : “.$b.‚<br/>”;

            echo “Float value : “.$c;

            $txt = “INDIA”;

            echo “I love $txt!”;

            $x = 2;

            $y = 2;

            echo $x + $y;

            function demo() {

            echo «<p>Variable x inside function is: $x</p>»;

            }

            demo();

            echo “<p>Variable x outside function is: $x</p>”;

            function myTest() {

            static $a = 0;

            echo $a;

            $a++;

            }

             

            myTest();

            echo “<br>”;

            myTest();

            echo “<br>”;

            myTest();

            ?>

            </body>

            <html>

 

OUTPUT

            Number is : 25

            String is : Hello

            Float value : 5.7

            I LOVE INDIA

            4

            0

            1

            2

            Variable x inside function is:

            Variable x outside function is: 2

  

Tags : Practical Experiments | Computer Applications , 12th Computer Applications : Practical Experiments
Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail
12th Computer Applications : Practical Experiments : PHP - Create and Execute Variables | Practical Experiments | Computer Applications


Privacy Policy, Terms and Conditions, DMCA Policy and Compliant

Copyright © 2018-2024 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.