Tag Archives: array

Swapping Array Keys and Values

In this article we discuss about Swapping Array Keys and Values.
If you want interchange the keys and values of an associative array. It’s very easy, just use PHP’s array_flip() function which perform a very specialized task. It reverses the key-value relationship for all the elements of an asso…

Leave a comment

Filed under PHP

Swapping Array Keys and Values

If you want Swapping Array Keys and Values. It’s very easy, just use PHP’s array_flip() function which perform a very specialized task. It reverses the key-value relationship for all the elements of an associative array and returning a new array that is the mirror image of the ori…

Leave a comment

Filed under PHP

PHP Interview Questions and Answers – Part 4

1- 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.
2- How do I find out the number of parameters passed into function9. ?
func_num_args()…

Leave a comment

Filed under PHP

Php Interview Questions and Answers – Part 3

1- What is the difference between CHAR and VARCHAR data types?
CHAR is a fixed length data type. CHAR(n) will take n characters of storage even if you enter less than n characters to that column. For example, “Hello!” will be stored as “Hello! ” in CHAR(10) column.
VARCHAR is a variable…

Leave a comment

Filed under PHP

Php Interview Questions and Answers – Part 2

1- Why doesn’t the following code print the newline properly? <?php $str = ‘Hello, there.nHow are you?nThanks for visiting techpreparation’; print $str; ?>
Because inside the single quotes the n character is not interpreted as newline, just as a sequence of two characters – and…

Leave a comment

Filed under PHP

Parse JSON, XML and HTML – jQuery

In this post, find out jQuery code on how to parse JSON, parse XML and parse HTML. If you are still using custom code for parsing any of these and making your life more miserable then stop doing it. Why? If you are not aware then here is a news for you that jQuery has inbuilt utility methods for…

Leave a comment

Filed under Uncategorized

Php Interview Questions and Answers – Part 1

1- What’s PHP ?
The PHP Hypertext Preprocessor is a programming language that allows web developers to create dynamic content that interacts with databases. PHP is basically used for developing web based software applications.
2- What Is a Session?
A session is a logical object created by the…

Leave a comment

Filed under PHP