Search

PHP
PHP- Upload a file PDF Print E-mail
Programming - PHP
Wednesday, 02 June 2010 19:41

 


 

PHP program to upload a file on to the server.

<html>
<body>
<?php
if(isset($_POST['submit']))
{

 
PHP if-else PDF Print E-mail
Programming - PHP
Thursday, 30 July 2009 08:03

 

Conditional statements are used to perform different actions based on different conditions.

 


Conditional Statements

Very often when you write code, you want to perform different actions for different decisions.

You can use conditional statements in your code to do this.

In PHP we have the following conditional statements:

  • if statement - use this statement to execute some code only if a specified condition is true
  • if...else statement - use this statement to execute some code if a condition is true and another code if the condition is false
  • if...elseif....else statement - use this statement to select one of several blocks of code to be executed
  • switch statement - use this statement to select one of many blocks of code to be executed

 
PHP Operators PDF Print E-mail
Programming - PHP
Saturday, 25 July 2009 16:53

 

 

This section lists the different operators used in PHP that is arithmetic operators, assignment operators, logical operators and comparison operators with examples.

 
String Variables in PHP PDF Print E-mail
User Rating: / 1
PoorBest 
Programming - PHP
Monday, 20 July 2009 08:05

 

 

String variables are used for values that contains characters.

In this chapter we are going to look at the most common functions and operators used to manipulate strings in PHP.

After we create a string we can manipulate it. A string can be used directly in a function or it can be stored in a variable.

Below, the PHP script assigns the text "Hello World" to a string variable called $txt:

<?php
$txt="Hello World";
echo $txt;
?>

The output of the code above will be:

Hello World

Now, lets try to use some different functions and operators to manipulate the string.


 
Variables in PHP PDF Print E-mail
Programming - PHP
Saturday, 18 July 2009 08:24

 

 

 

Variables are used for storing a values, like text strings, numbers or arrays.

When a variable is declared, it can be used over and over again in your script.

All variables in PHP start with a $ sign symbol.

The correct way of declaring a variable in PHP:

$var_name = value;

New PHP programmers often forget the $ sign at the beginning of the variable. In that case it will not work.

Let's try creating a variable containing a string, and a variable containing a number:

$txt="Hello World!";
$x=16;
?>

 

 

Last Updated on Wednesday, 22 July 2009 07:26
 
PHP Basics PDF Print E-mail
Programming - PHP
Tuesday, 14 July 2009 08:20

PHP code is executed on the server, and the plain HTML result is sent to the browser.

Basic PHP Syntax

A PHP scripting block always starts with <?php and ends with ?>. A PHP scripting block can be placed anywhere in the document.

On servers with shorthand support enabled you can start a scripting block with <? and end with ?>.

For maximum compatibility, we recommend that you use the standard form (<?php) rather than the shorthand form.

<?php
?>

A PHP file normally contains HTML tags, just like an HTML file, and some PHP scripting code.

Below, we have an example of a simple PHP script which sends the text "Hello World" to the browser:

<html>
<body>

<?php
echo "Hello World";
?>

</body>
</html>

Each code line in PHP must end with a semicolon. The semicolon is a separator and is used to distinguish one set of instructions from another.

 
«StartPrev12NextEnd»

Page 1 of 2
We have 93 guests online