COMPUTER LANGUAGES | PHP | PHP INTERVIEW QUESTION AND ANSWERS - 09

PHP Interview Question and Answers:


36.     How many open modes available when a file open in PHP?
      r  , r+  , w  , w+  , a  , a+  , x  , x+

37.     Explain the types of string comparision function in PHP.
     
      Function                         Descriptions
1.     strcmp()                         Compares two strings (case sensitive)
2.     strcasecmp()                   Compares two strings (not case sensitive)
3.     strnatcmp(str1, str2);       Compares two strings in ASCII order, but any numbers are compared numerically
4.     strnatcasecmp(str1, str2);     Compares two strings in ASCII order, case insensitive, numbers as numbers
5.     strncasecomp()                   Compares two strings (not case sensitive) and allows you to             specify how many characters to compare

6.     strspn()                              Compares a string against characters represented by a mask
7.     strcspn()                             Compares a string that contains characters not in the mask

38.     Explain soundex() and metaphone().
      soundex()
The soundex() function calculates the soundex key of a string. A soundex key is a four character long alphanumeric string that represent English pronunciation of a word. he soundex() function can be used for spelling applications.
<?php
$str = "hello";
echo soundex($str);
?>

metaphone()
The metaphone() function calculates the metaphone key of a string. A metaphone key represents how a string sounds if said by an English speaking person. The metaphone() function can be used for spelling applications.
<?php
echo metaphone("world");
?>

39.     Explain the types of functions for Splitting String?
     
      Function                    Descriptions
1.     split()            Splits a string into an array by using a regular expression as the delimiter.
2.     spliti()           Splits a string into an array by a regular expression and is case insensitive.
3.     str_split()      Converts a string into an array where the size of the elements can be specified
4.     preg_split()    Splits up a string by a Perl compatible regular expression and returns an array of substrings
5.     explode()       Splits up a string by another string (not a regular expression) and returns an array
6.     implode()       Joins array elements together by a string and returns a string

40.     Explain Whitespace Characters.
     
Whitespace Character     ASCII Value(Decimal/Hex)     Descriptions
" "                                    32 (0x20))                             An ordinary space
"\t"                                   9(0x0)                                   A tab.
"\n"                                  10(0x0A)                               A newline (line feed).
"\r"                                   13(0x0D))                             A carriage return.
"\0"                                  0(0x00))                                The NULL-byte.
"\x0B"                             11(0x0B))                               A vertical tab.

1 comment:

  1. Hi,

    I am jobless now. Please give me some work if you have.
    You can pay me whatever you feel reasonable after completion of the task.

    What I can do:
    Data entry, processing and conversion (I have typing speed more than 60-word per minute)
    SEO: link building using various platforms such as forums, blogs, social media, Q&A websites and more
    I know some popular programming languages such as PHP, Python, HTML, CSS, AHK etc. but I am not confident to my programming skills.
    I can communicate in English comfortably but I'm not a native speaker.

    What I can't do:
    I can't do complex calculation.
    I can't do graphic design related tasks....

    Thanks
    Pawan
    Email: admin@e07.net

    ReplyDelete