Saturday, July 5, 2008

Have you Differences between PHP4 and PHP5 or Migrating from PHP 4 to PHP 5

PHP4 is not full OOP based language while php5 is fully OOPs based laguage.The 2 biggest differences are that PHP5 is more object oriented with true classes. Of course in PHP 4 you can program in the object oriented style, but they weren't true objects.

the object model has been greatly improved in PHP5 (__construct and __destruct methods, improvements in member variable protection, polymorphism, interfaces- SQLite, a new embedded DB;
- New MySQLi interface;
- SimpleXML, a simplified interface for reading XML files (not suitable for writing them)
PHP 5 and the integrated Zend Engine 2 have greatly improved PHP's performance and capabilities, but great care has been taken to break as little existing code as possible. So migrating your code from PHP 4 to 5 should be very easy. Most existing PHP 4 code should be ready to run without changes, but you should still know about the few differences and take care to test your code before switching versions in production environments.

do you create subdomains using PHP?

* Create the appropriate web root directory, for example /home/sites/username/web , and any subdirectories you wish
* Edit httpd.conf - add a new virtual host section
* Restart httpd

and also we can use another ways for this.

You can crate a virtual domain by using .htaccess file and you need to set some little things in control panel.
by using .htaccess file you can crate like as a under mention example.
http://www.domain.com/?a=user --> http://user.domain.com/

can we submit a form without a submit button in php?

yes we can submit a form without submit button. there are number of ways for this:-

1.On onclick event by javascript. you can call a javascript function in which you can submit a form.for this we have use the srcipt document.forms[0].submit();

2.On body load i.e.when full dody of the page is loadedthen onLoad function in body tag you can call a javascript function which will submit the form as in the first case.

3.You can use XmlHTTPRequest object (AJAX) to submit a form. for this AJAX srcipt the page will not refresh and form will submited.

What is use header() function in php

header()function being used for page redirection in php,this specific location being define, page authentication, assigning content type, cache control.

Basic Syntax and Example of PHP

You should save your file with the extension .php in php language.


$txt = "This is my first PHP script";
/* This line creates the variable $txt and gives it the initial value. Variables in PHP are represented by a dollar sign followed by the name of the variable. The variable name is case-sensitive. */

echo $txt;
?>

What is Php

php is server based side language.php is stands for "Hypertext Preprocessor" language. php language used for create dynamic web pages. now days most popular language in world. this is the combination of number of languages like as C, java ,peal with some unique features. this is use for quick genrated dynamic pages and development sites. the "$" sign use as a syntax in php. the open tage and close tags which are using in this language are as "" and "". in php many databases including MySQL, Informix, Oracle, Sybase, Solid, PostgreSQL, and Generic ODBC. The popular PHP-MySQL combination (both are open-source products) is available on almost every UNIX host.