Thursday, 1 May 2014

PHP Program To Find Reverse Of A Number Or String

<?php
$int = "Ritu Raj";// here you can use any number or string
$reverse = strrev($int); // for reversing the string
echo "String: " . $int . "<br>";
echo "Reverse String : " . $reverse ;
?>

OutPut:

String: Ritu Raj
Reverse String : jaR utiR

PHP Program To Find A Anagram

An anagram is a rearrangement of the letters of one word or phrase to form another word or phrase.
In other words :"Any word or phrase that exactly reproduces the letters in another order is an anagram."
For example, "orchestra" is a transposition of "carthorse",
                      "dog" is a transposition of "god",
                      "army" is a transposition of "mary".
Note : The original word or phrase is known as the subject of the anagram.

A simple PHP Program for Anagram is given below

<?php
if(empty($word)) $word="dog";
for($i=0;$i<strlen($word);$i++) {
  $letters[$i]=substr($word,$i,1);
}
shuffle($letters);
$anagram=implode($letters);
echo "One anagram of $word is $anagram.";
?>

Output :

One anagram of dog is god
One anagram of dog is gdo,
One anagram of dog is dgo
and more....

When you execute the program then subjected word will change after refresh the page and that word or pharse will be anagram of subjected word or phrase.

Tuesday, 22 April 2014

Web Services For Mobile App iPhone or Android Using PHP And MYSQL



Web Services is a method for communicating two electronic devices over a single network.

XML + HTTP is the basic Web services platform.

Component of Web services:

1. SOAP (Simple Object Access Protocol)

2. UDDI (Universal Description, Discovery and Integration)

3. WSDL (Web Services Description Language)

Note: You can also use Json for Web Services



  1. Make Database and table as per need
  2. Write PHP Script using $_SERVER['REQUEST_METHOD']=="POST/PUT/GET/DELETE";
  3. Run PHP Script using localhost
  4. copy the url link of script page
  5. Open your Google Chrome and add extension "Advance Rest Client"
  6. Open Advance Rest Client
  7. Add localhost url and add it to Advance Rest Client Using Select Method(Eg : POST,PUT,GET,DELETE) and also Add the parameter of PHP Script in add new Value.
  8. Then click Send button in  Advance Rest Client it will show results that you web services is perfectly working or not.


Here you can find the code please click below
DEMO

Sunday, 20 April 2014

Expire Session Automatically After A Valid Time Period Using PHP

Here You can find the PHP code to "Expire Session Automatically After A Valid Time Period Using PHP"

Here you can find the code please click below
DEMO

Wednesday, 9 April 2014

To Calculate Age Using PHP

Here you can find the Age Calculator using PHP.

Here you can find the code please click below
DEMO

PHP Code To Find Web Browser And Operating System

This will help you to find, what kind of browser and operating system is used to view this page? 
 Here you can find the code please click below
DEMO

Random image display after refreshing page in PHP

This code will help you to change the background image of a page randomly after refreshing  page, using a function

i.e:- rand();

Here rand (1,5); is used to display 1 to 5 images dynamically changes when a user refresh the page
Here you can find the code please click below
DEMO

Friday, 4 April 2014

Database Values Preview in browser as Json file using PHP and MYSQL for Mobile APPS Web Services

1. Make a database in phpmyadmin
 2. Make a table with your requred field.
 3. And then wirte code to make json file in php for table which is in database.
Here you can find the code please click below
DEMO

Code to Preview XML file using PHP and MYSQL in browser for Mobile APPS Web Services

1. Make a database in phpmyadmin

 2. Make a table with your requred field.

 3. And then wirte code to make xml file in php for table which is in database.
Here you can find the code please click below
DEMO

Thursday, 3 April 2014

Upload CSV File To Database Using PHP and MYSQL

Here is the simple way to upload/import csv file Database.
Here you can find the code please click below
DEMO

Thursday, 27 March 2014

Program to find a string is Palindrome or Not in Php

<?php
$word = "Malayalam";  // declaring a varibale
echo "String: " . $word . "<br>";
$reverse = strrev($word); // reversing word
if ($word == $reverse) // comparing if original word is same as the reverse of the same word
    echo 'Output: The string is a palindrome';
else
    echo 'Output: This is not a palindrome';
?>

Find the string palindrome or not in PHP without using strrev() function.

<?php
$mystring = "madam"; // set the string
echo "String: " . $mystring;
$myArray = array(); // php array
$myArray = str_split($mystring); // split the array
$len = sizeof($myArray); // get the size of array
$newString = "";

for ($i = $len; $i >= 0; $i--) {
    $newString.=$myArray[$i];
}
echo "<br>";
if ($mystring == $newString) {
    echo "Output: " . $mystring . " is a palindrome";
} else {
    echo "Output: " . $mystring . " is not a palindrome";
}
?>

Printing first 50 Fibonacci numbers Using PHP Program

Fibonacci series is a series of numbers in which each number is the sum of the two preceding numbers. For example. 0 , 1 , 1 , 2 , 3 , 5...