Accenture PHP Most Frequently Asked Interview Questions

What Is The Functionality Of The Function Strstr And Stristr?

strstr() returns part of a given string from the first occurrence of a given substring to the end of the string. For example: strstr("user@example.com","@") will return "@example.com".
stristr() is idential to strstr() except that it is case insensitive.

What Is The Difference Between Ereg_replace() And Eregi_replace()?

eregi_replace() function is identical to ereg_replace() except that it ignores case distinction when matching alphabetic characters.

How Do I Find Out The Number Of Parameters Passed Into Function9?

func_num_args() function returns the number of parameters passed in.

What Is The Purpose Of The Following Files Having Extensions: Frm, Myd, And Myi? What These Files Contain?

In MySQL, the default table type is MyISAM.
Each MyISAM table is stored on disk in three files. The files have names that begin with
the table name and have an extension to indicate the file type.

The '.frm' file stores the table definition.
The data file has a '.MYD' (MYData) extension.
The index file has a '.MYI' (MYIndex) extension.
Accenture PHP Most Frequently Asked Latest Interview Questions Answers
Accenture PHP Most Frequently Asked Latest Interview Questions Answers

If The Variable $a Is Equal To 5 And Variable $b Is Equal To Character A, What's The Value Of $$b?


5, it’s a reference to existing variable.

How To Protect Special Characters In Query String?

If you want to include special characters like spaces in the query string, you need to protect them by applying the urlencode() translation function. The script below shows how to use urlencode():

<?php
print("<html>");
print("<p>Please click the links below"
." to submit comments about FYICenter.com:</p>");
$comment = 'I want to say: "It\'s a good site! :->"';
$comment = urlencode($comment);
print("<p>"
."<a href=\"processing_forms.php?name=Guest&comment=$comment\">"
."It's an excellent site!</a></p>");
$comment = 'This visitor said: "It\'s an average site! :-("';
$comment = urlencode($comment);
print("<p>"
.'<a href="processing_forms.php?'.$comment.'">'
."It's an average site.</a></p>");
print("</html>");
?>

Are Objects Passed By Value Or By Reference?
Everything is passed by value.

What Are The Differences Between Drop A Table And Truncate A Table?
DROP TABLE table_name - This will delete the table and its data.

TRUNCATE TABLE table_name - This will delete the data of the table, but not the table definition.

What Is The Difference Between Characters \023 And \x23?

The first one is octal 23, the second is hex 23.

How Can We Submit Form Without A Submit Button?
We can use a simple JavaScript code linked to an event trigger of any form field. In the JavaScript code, we can call the document.form.submit() function to submit the form. For example: <input type=button value="Save" onClick="document.form.submit()">.

How Can We Create A Database Using Php And Mysql?
We can create MySQL database with the use of mysql_create_db($databaseName) to create a database.

How Many Ways We Can Retrieve The Date In Result Set Of Mysql Using Php?
As individual objects so single record or as a set or arrays.

How Many Ways Can We Get The Value Of Current Session Id?

session_id() returns the session id for the current session.

Can We Use Include ("abc.php") Two Times In A Php Page "makeit.php"?
Yes.

What's The Difference Between Include And Require?

It’s how they handle failures. If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.

Explain The Ternary Conditional Operator In Php?
Expression preceding the ? is evaluated, if it’s true, then the expression preceding the : is executed, otherwise, the expression following : is executed.

What Type Of Headers Have To Be Added In The Mail Function To Attach A File?

$boundary = '--' . md5( uniqid ( rand() ) );
$headers = "From: \"Me\"\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: multipart/mixed; boundary=\"$boundary\"";

List Out Different Arguments In Php Header Function?
void header ( string string [, bool replace [, int http_response_code]]).

What Are The Different Functions In Sorting An Array?
Sorting functions in PHP:
asort()
arsort()
ksort()
krsort()
uksort()
sort()
natsort()
rsort()

How Can We Know The Count / Number Of Elements Of An Array?
2 ways:

sizeof($array) - This function is an alias of count().
count($urarray) - This function returns the number of elements in an array. Interestingly if you just pass a simple var instead of an array, count() will return 1.

How Many Ways I Can Redirect A Php Page?

Here are the possible ways of php page redirection.

1. Using Java script:
'; echo 'window.location.href="'.$filename.'";'; echo ''; echo ''; echo ''; echo ''; } }
redirect

2. Using php function: header

How Many Ways We Can Pass The Variable Through The Navigation Between The Pages?

At least 3 ways:

1. Put the variable into session in the first page, and get it back from session in the next page.
2. Put the variable into cookie in the first page, and get it back from the cookie in the next page.
3. Put the variable into a hidden form field, and get it back from the form in the next page.

What Is The Maximum Length Of A Table Name, A Database Name, Or A Field Name In Mysql?
Database name: 64 characters
Table name: 64 characters
Column name: 64 characters

How Many Values Can The Set Function Of Mysql Take?
MySQL SET function can take zero or more values, but at the maximum it can take 64 values.


Post a Comment

Previous Post Next Post