Wednesday, November 18, 2009

What are the various methods to pass data from one web page to another web page ?

Below are the ways to pass data acros the pages:

1.POST
2.GET
3.SESSION
4.COOKIES
5.QUERY STRING

What is a Zend Engine?

The Zend Engine is an open source scripting engine (a Virtual Machine), commonly known for the important role it plays in the web automation language PHP.

The current version of the virtual machine is The Zend Engine II and is at the heart of PHP 5.

What are the types of Storage Engines MySQL supports?

MySQL supports several storage engines that act as handlers for different table types. MySQL storage engines include both those that handle transaction-safe tables and those that handle nontransaction-safe tables.

To determine which storage engines your server supports by using the SHOW ENGINES statement. The value in the Support column indicates whether an engine can be used. A value of YES, NO, or DEFAULT indicates that an engine is available, not available, or avaiable and current set as the default storage engine.

MySQL 5.1 supported storage engines

1. MyISAM ? The default MySQL storage engine and the one that is used the most in Web, data warehousing, and other application environments. MyISAM is supported in all MySQL configurations, and is the default storage engine unless you have configured MySQL to use a different one by default.

2. InnoDB ? A transaction-safe (ACID compliant) storage engine for MySQL that has commit, rollback, and crash-recovery capabilities to protect user data. InnoDB row-level locking (without escalation to coarser granularity locks) and Oracle-style consistent nonlocking reads increase multi-user concurrency and performance. InnoDB stores user data in clustered indexes to reduce I/O for common queries based on primary keys. To maintain data integrity, InnoDB also supports FOREIGN KEY referential-integrity constraints.

3. Memory ? Stores all data in RAM for extremely fast access in environments that require quick lookups of reference and other like data. This engine was formerly known as the HEAP engine.

4. Merge ? Allows a MySQL DBA or developer to logically group a series of identical MyISAM tables and reference them as one object. Good for VLDB environments such as data warehousing.

5. Archive ? Provides the perfect solution for storing and retrieving large amounts of seldom-referenced historical, archived, or security audit information.

6. Federated ? Offers the ability to link separate MySQL servers to create one logical database from many physical servers. Very good for distributed or data mart environments.

7. NDBCLUSTER (also known as NDB) ? This clustered database engine is particularly suited for applications that require the highest possible degree of uptime and availability.

8. CSV ? The CSV storage engine stores data in text files using comma-separated values format. You can use the CSV engine to easily exchange data between other software and applications that can import and export in CSV format.

9. Blackhole ? The Blackhole storage engine accepts but does not store data and retrievals always return an empty set. The functionality can be used in distributed database design where data is automatically replicated, but not stored locally.

10. Example ? The Example storage engine is ?stub? engine that does nothing. You can create tables with this engine, but no data can be stored in them or retrieved from them. The purpose of this engine is to serve as an example in the MySQL source code that illustrates how to begin writing new storage engines. As such, it is primarily of interest to developers.

What type of inheritance that php supports?

PHP support the Multilevel inheritance Not a multiple inheritance.

For Example:

class A{

function hello();
}

// This is possible.
class B extends A{

function helloB();
}

// This is not possible, IT gives the fatal error.
class C extends A{

function helloC();
}

Where Is Session Data Stored?

Sessions work by creating a unique id (UID) for each visitor and store variables based on this UID. The UID is either stored in a cookie or is propagated in the URL.
The most significant differences between the two are that cookies are stored on the client, while the session data is stored on the server. As a result, sessions are more secure than cookies (no information is being sent back and forth between the client and the server) and sessions work even when the user has disabled cookies in their browser. Cookies, on the other hand, can be used to track information even from one session to another by setting it's time( ) parameter

The session.save_path setting specifies the directory name for session data.

What is the purpose of ob_start() ?

This function will turn output buffering on. While output buffering is active no output is sent from the script (other than headers), instead the output is stored in an internal buffer.

The contents of this internal buffer may be copied into a string variable using ob_get_contents(). To output what is stored in the internal buffer, use ob_end_flush(). Alternatively, ob_end_clean() will silently discard the buffer contents.

Output buffers are stackable, that is, you may call ob_start() while another ob_start() is active. Just make sure that you call ob_end_flush() the appropriate number of times. If multiple output callback functions are active, output is being filtered sequentially through each of them in nesting order.

What are new features that are in added in PHP5?

Following are new features added in PHP5

1. PHP 5 introduces the Standard PHP Library (SPL) which provides a number of ready-made classes and interfaces.
2. Access Modifiers are added in PHP5
3. PHP5 has built-in exception classes that makes it very easy to create your own customized exceptions through inheritance.
4. PHP 5 introduces the mysqli (MySQL Improved) extension with support for the features of MySQL databases versions 4.1 and higher. So use of prepare statements are allowed
5. PHP5 comes with PDO which is a common interface for different database systems is only made possible by the new object model.
6. SQLite is a database engine incorporated in php5 which can be used to develope faster leaner and more versatile applications.
7. In PHP 5 all Extensible Markup Language (XML) support is provided by the libxml2 XML toolkit.
8. The reflection classes included in PHP 5 provide ways to introspect objects and reverse engineer code.
9. In addition to built-in classes PHP 5 also offers built-in interfaces. Iterator is the most important as a number of classes and interfaces are derived from this interface.
10. PHP 5 introduces a number of new "magic" methods. Magic methods begin with a double underscore and this requires changing any user-defined methods or functions that use this naming convention.
11. The major change to PHP in version 5 relating to OOP is usually summed up by saying that objects are now passed by reference.

What is the difference between session_register() and $_SESSION?

Following are differences between session_register and $_SESSION

1. session_register function returns boolean value, whereas $_SESSION returns string value.

2. session_register function does'nt work if register_global is disabled. $_SESSION works in both case whether register_global is disabled or enabled.
So using $_SESSION for session variable manipulation is more appropriate.

Which will execute faster POST or GET? Explain

POST is most secure so it have to pass some process. GET is simple way to send via URL so it is will be fast.

What is the difference between echo and print statement?

Both echo and print are language constructs.

However print() acts like a function in that it returns a value and can be used in complex expressions.

Furthermore echo without parentheses can take multiple arguments. Echo with parentheses and print can only take a single argument.

How to upload the file from one server to Remote server?

$fileToBeUploaded = "filename.txt";

$source = fopen($fileToBeUploaded,"r");
$conn = ftp_connect("ftp.myserver.com");
ftp_login($conn,"","");

ftp_fput($conn,"/path_to_folder_on_remote_server/newfile.txt",$source,FTP_ASCII);

ftp_close($conn);