IGNOU Best Coaching Institute in Delhi NiPS Institute collaborated with IGNOUFriend to Provide free support and solution to IGNOU BCA MCA Students
Thanks NiPS Institute for IGNOU BCA MCA Students
Question : What is PHP and Its variable
PHP is a programming language,It is used for making dynamic and interactive Web pages. PHP is a widely-used, free ans easy to learn.Before you continue you should have a basic knowledge in HTML and javascript.whenever we need to create a dynamic html file, we need to create a file contain our program logic as a php script with .php as the extension, we can add html tags and javascript etc in the same file.PHP file can open,read or close file in server and establish a database connection and query something from the database, anything can do like other scripting languages such as ASP,JSP etc
The php script executed on the web server such as apache server and return html to the browser
example: <?php echo "Hello world"; ?>
This script print "Hello world" in your browser as output. The echo is a function used to print a value in the out put html
This script print "Hello world" in your browser as output. The echo is a function used to print a value in the out put html
Every code line in PHP must end with a semicolon. The semicolon is a separator between the instructions from another.If you forgot to put a semicolon,php compiler will return an error
Question : What are the PHP Variables
A variable is a memory location to store a value.In PHP the value may be a string,number,flot,array even an object of a class etc. A variable begins with the $ sign
Rules for declare PHP variables:
- A variable begins with the $ sign,followed by its name
- A variable name must start with a letter or _ charactor
- A variable name can only contain letters , number and _ charactor (A-z,0-9, and _)
- Variable names are case sensitive $y not equal $Y
System allocated a space for a variable only when you assign a value for it
<?$txt="Hello world!";
$x=5;?> .
Question : How to write Comments in PHP
We can write comments in php script like the following
<?php
// This type comment is used to write a single line comment
echo “Hello php”;
/*
This is
a PHP comment
block
*/
?>
No comments:
Post a Comment