Saturday 28 April 2012

PHP Interview question 13


46) What is the difference between ereg_replace() and eregi_replace()?
Ans : eregi_replace() function is identical to ereg_replace() except that this ignores case distinction when matching alphabetic characters.eregi_replace() function is identical to ereg_replace() except that this ignores case distinction when matching alphabetic characters.

47) What are the different functions in sorting an array?
Ans :      Sort(), arsort(), asort(), ksort(), natsort(), natcasesort(), rsort(), usort(), array_multisort(), and
uksort().

48) How can we know the count/number of elements of an array?
Ans :      2 ways
a) sizeof($urarray) This function is an alias of count()
b) count($urarray)

49) what is session_set_save_handler in PHP?
Ans :      session_set_save_handler() sets the user-level session storage functions which are used for storing and retrieving data associated with a session. This is most useful when a storage method other than those supplied by PHP sessions is preferred. i.e. Storing the session data in a local database.          

50) How can I know that a variable is a number or not using a JavaScript?
Ans :      bool is_numeric ( mixed var)
Returns TRUE if var is a number or a numeric string, FALSE otherwise.or use isNaN(mixed var)The isNaN() function is used to check if a value is not a number.

No comments:

Post a Comment