Senior PHP Programmer

  Home  Computer Programming  Senior PHP Programmer


“Sr. PHP Programmer based Frequently Asked Questions by expert members with experience as Senior PHP Programmer. These questions and answers will help you strengthen your technical skills, prepare for the new job test and quickly revise the concepts”



202 Senior PHP Programmer Questions And Answers

122⟩ How will you create objects in PHP?

Once you defined your class, then you can create as many objects as you like of that class type. Following is an example of how to create object using new operator.

$physics = new Books;

$maths = new Books;

$chemistry = new Books;

 218 views

125⟩ What is function overriding?

Function definitions in child classes override definitions with the same name in parent classes. In a child class, we can modify the definition of a function inherited from parent class.

 212 views

126⟩ How will you close a MySql database using PHP?

Its simplest function mysql_close PHP provides to close a database connection. This function takes connection resource returned by mysql_connect function. It returns TRUE on success or FALSE on failure.

bool mysql_close ( resource $link_identifier );

If a resource is not specified then last opend database is closed.

 206 views

127⟩ What is PEAR?

PEAR is a framework and distribution system for reusable PHP components. The project seeks to provide a structured library of code, maintain a system for distributing code and for managing code packages, and promote a standard coding style.

PEAR is broken into three classes: PEAR Core Components, PEAR Packages, and PECL Packages. The Core Components include the base classes of PEAR and PEAR_Error, along with database, HTTP, logging, and e-mailing functions. The PEAR Packages include functionality providing for authentication, networking, and file system features, as well as tools for working with XML and HTML templates.

 217 views

129⟩ Difference between mysql_connect and mysql_pconnect?

There is a good page in the php manual on the subject, in short mysql_pconnect() makes a persistent connection to the database which means a SQL link that do not close when the execution of your script ends. mysql_connect()provides only for the databasenewconnection while using mysql_pconnect , the function would first try to find a (persistent) link that's already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection... the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use.

 223 views

130⟩ What is Object-Oriented Methodology?

Object orientation is a software/Web development methodology that is based on the modeling a real world system. An object is the core concept involved in the object orientation. An object is the copy of the real world enity. An object oriented model is a collection of objects and its inter-relationships

 214 views

133⟩ Write a program using while loop?

$my_qry = mysql_query("SELECT * FROM `users` WHERE `u_id`='1'; ");

while($result = mysql_fetch_array($my_qry))

{

echo $result['First_name'.]."

";

}

 208 views

134⟩ What are the different errors in PHP?

In PHP, there are three types of runtime errors, they are:

☛ Warnings:

These are important errors. Example: When we try to include () file which is not available. These errors are showed to the user by default but they will not result in ending the script.

☛ Notices:

These errors are non-critical and trivial errors that come across while executing the script in PHP. Example: trying to gain access the variable which is not defined. These errors are not showed to the users by default even if the default behavior is changed.

☛ Fatal errors:

These are critical errors. Example: instantiating an object of a class which does not exist or a non-existent function is called. These errors results in termination of the script immediately and default behavior of PHP is shown to them when they take place. Twelve different error types are used to represent these variations internally.

 209 views

138⟩ How to find current date and time?

The date() function provides you with a means of retrieving the current date and time, applying the format integer parameters indicated in your script to the timestamp provided or the current local time if no timestamp is given. In simplified terms, passing a time parameter is optional - if you don't, the current timestamp will be used.

 198 views

139⟩ What is the purpose of date() function?

The date() function returns a formatted string representing a date. You can exercise an enormous amount of control over the format that date() returns with a string argument that you must pass to it.

 211 views