How To Ideas | How To Articles | How To Tutorials


0

How to Write Your First PHP Code


Under the label PHP you can learn basics, intermediate and advanced programming in PHP. If you are the beginner lets start with your first script in PHP.


<html>
<head>
    <title>First PHP Script</title>
</head>
<body>
    <?php
        echo "This is the text using PHP.";
    ?>
</body>
</html>

In the above example there is a basic structure of HTML. In the body tag I used PHP code. To start the PHP code there is tag which specifies the starting and ending of PHP code. “<?php” denotes the starting of PHP tag and “?>” denotes the ending tag. In between there is a function “echo” it prints the value passed in it. “echo” is not actually a function we can pass value in double quotes also like I did in this example. It can also be called as:


<?php
    echo ("This is the text using PHP.");
?>

Both examples results the same thing. If you want to pass multiple parameters in the “echo” function.Then use the following code:


<?php
    echo "PHP ", "is ", "a ", "great ", "language.";
?>

Enjoy…

Filed in: PHP Tags: , , ,

Leave a Reply

Submit Comment



© 3339 How To Ideas. All rights reserved.
Proudly designed by Theme Junkie.