Tuesday, 6 January 2015

When a function is completed, all of its variables are normally deleted. 

However, sometimes you want a local variable to not be deleted.

To do this, use the 'static' keyword when you first declare the variable






The Output will be shown as:
123

So,each time the function is called, that variable will still have the information it contained from the last time the function was called.

Static Variable

When a function is completed, all of its variables are normally deleted. 

However, sometimes you want a local variable to not be deleted.

To do this, use the 'static' keyword when you first declare the variable






The Output will be shown as:
123

So,each time the function is called, that variable will still have the information it contained from the last time the function was called.
This entry was posted in :

Monday, 5 January 2015

The concatenation operator (.)  is used to join two string values together.

 The following example show how two string are concatenated.




The result will be shown as :

getcoderesults 

If we need space between two strings then we use two concat operator between two strings






&lt?php

echo "hello friends";

?>

PHP Concatenation Operator

The concatenation operator (.)  is used to join two string values together.

 The following example show how two string are concatenated.




The result will be shown as :

getcoderesults 

If we need space between two strings then we use two concat operator between two strings






&lt?php

echo "hello friends";

?>

This entry was posted in :

Sunday, 4 January 2015

We know the length of a string value in PHP.
 
The strlen() function returns the length of a string, in characters.

The following example show the use of strlen()





The result is shown:
15

strlen() function

We know the length of a string value in PHP.
 
The strlen() function returns the length of a string, in characters.

The following example show the use of strlen()





The result is shown:
15

This entry was posted in :

Saturday, 3 January 2015

The strpos() function is used to search for a character or a specific text within a string.

If a match is found, it will return the character position of the first match. 

If no match is found, it will return nothing.


The following example how to use a strpos():




 The result is come:

24




If the word is not present in the string, then no output will be displayed:



<?php
echo 'hello world';
?>

strpos() function

The strpos() function is used to search for a character or a specific text within a string.

If a match is found, it will return the character position of the first match. 

If no match is found, it will return nothing.


The following example how to use a strpos():




 The result is come:

24




If the word is not present in the string, then no output will be displayed:



<?php
echo 'hello world';
?>
This entry was posted in :

Friday, 2 January 2015

Variables are "containers" for storing information. Variables are represented '$' symbol in the PHP language.

A variable starts with the $ sign, followed by the name of the variable

A variable name must begin with a letter or the underscore character

A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )

A variable name should not contain spaces

Variable names are case sensitive ($y and $Y are two different variables)









The result is =11;


Variable Declaration

Variables are "containers" for storing information. Variables are represented '$' symbol in the PHP language.

A variable starts with the $ sign, followed by the name of the variable

A variable name must begin with a letter or the underscore character

A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )

A variable name should not contain spaces

Variable names are case sensitive ($y and $Y are two different variables)









The result is =11;


This entry was posted in :

Thursday, 1 January 2015

PHP is a server scripting language, and is a powerful tool for making dynamic and interactive Web pages.

PHP stands for PHP: Hypertext Preprocessor.It is a widely-used, open source scripting language.
Its scripts are executed on the server. It is free to download and use.

To start using PHP, we have:
 install a web server
 a web host with PHP and MySQL support.
Install a web server on your own PC, and then install PHP and MySQL

A PHP script can be placed anywhere in the document.
A PHP script starts with <?php and ends with ?>:

<?php
// PHP code goes here

?>

 The default file extension for PHP files is ".php".





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.

General Introduction

PHP is a server scripting language, and is a powerful tool for making dynamic and interactive Web pages.

PHP stands for PHP: Hypertext Preprocessor.It is a widely-used, open source scripting language.
Its scripts are executed on the server. It is free to download and use.

To start using PHP, we have:
 install a web server
 a web host with PHP and MySQL support.
Install a web server on your own PC, and then install PHP and MySQL

A PHP script can be placed anywhere in the document.
A PHP script starts with <?php and ends with ?>:

<?php
// PHP code goes here

?>

 The default file extension for PHP files is ".php".





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.

This entry was posted in :
PHP is a server scripting language, and is a powerful tool for making dynamic and interactive Web pages.

PHP stands for PHP: Hypertext Preprocessor

PHP is a widely-used, open source scripting language

PHP scripts are executed on the server

PHP is free to download and use.

PHP is a server scripting language, and a powerful tool for making dynamic and interactive 

Web pages.

PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft's ASP.

Introduction

PHP is a server scripting language, and is a powerful tool for making dynamic and interactive Web pages.

PHP stands for PHP: Hypertext Preprocessor

PHP is a widely-used, open source scripting language

PHP scripts are executed on the server

PHP is free to download and use.

PHP is a server scripting language, and a powerful tool for making dynamic and interactive 

Web pages.

PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft's ASP.
This entry was posted in :

Sunday, 12 January 2014

Definition
An array is basically a series of objects of same type. Each object in an array is known as an array element. Our motive here is to find the sum of elements stored in an array entered by the user. An array is declared as: 
int arr[10];
where arr[ ] is the array and arr[1], arr[2], arr[3] so on.. are the array elements. Values could be assigned to these array elements as:
arr[1]=10;
arr[2]=7;
arr[3]=13;
Sample Program
:
#include <iostream>

using namespace std;

int main()
{
    int a[10],n,i;
    int sum(int [],int n );
    cout << "Enter size of array=" << endl;
    cin>>n;
    cout<<"Enter array elements=";
    for(i=0;i<n;i++)
    {
    cin>>a[i];
    }
    cout<<"Sum is="<<sum(a,n);
}
    int sum(int a[],int n)
    {
        int s=0,i;
        for(i=0;i<n;i++)
        {
        s=s+a[i];
        }

        return s;
    }


Adding elements in array in c++ using functions

Definition
An array is basically a series of objects of same type. Each object in an array is known as an array element. Our motive here is to find the sum of elements stored in an array entered by the user. An array is declared as: 
int arr[10];
where arr[ ] is the array and arr[1], arr[2], arr[3] so on.. are the array elements. Values could be assigned to these array elements as:
arr[1]=10;
arr[2]=7;
arr[3]=13;
Sample Program
:
#include <iostream>

using namespace std;

int main()
{
    int a[10],n,i;
    int sum(int [],int n );
    cout << "Enter size of array=" << endl;
    cin>>n;
    cout<<"Enter array elements=";
    for(i=0;i<n;i++)
    {
    cin>>a[i];
    }
    cout<<"Sum is="<<sum(a,n);
}
    int sum(int a[],int n)
    {
        int s=0,i;
        for(i=0;i<n;i++)
        {
        s=s+a[i];
        }

        return s;
    }


This entry was posted in :