Advanced PHP Interviews Questions
Can we use include ("ABC.PHP”) two times in a PHP page “index.PHP”?
Answers: Yes we can use include("ABC.php”) more than one time in any page. but it creates a prob when xyz.php file contains some functions declaration then an error will come for already declared function in this file else not a prob like if you want to show same content two times in the page then must include it two times not a prob.
What are the different tables present in MySQL, which one is
default?
Answers : Following tables (Storage Engine) we can create
1. MyISAM(The default storage engine IN MYSQL 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. An .frm file stores the table format.
The data file has an .MYD extension. The index file has an .MYI
2. InnoDB(InnoDB is a transaction-safe (ACID compliant) storage engine for
MySQL that has commit, rollback, and crash recovery capabilities to protect user
data.)
3. Merge
4. Heap (MEMORY)(The MEMORY storage engine creates tables with contents
that are stored in memory. Formerly, these were known as HEAP tables.
What is use of header() function in php ?
Answers :The header() function sends a raw HTTP header to a client.We can use
herder()
function for redirection of pages. It is important to notice that header() must
be called before any actual output is seen.
How can I execute a PHP script using command line?
Answers :Just run the PHP CLI (Command Line Interface) program and
provide the PHP script file name as the command line argument.
Suppose your Zend engine supports the mode Then how can you
configure your PHP Zend engine to support mode ?
Answers :In php.ini file:
set
short_open_tag=on
to make PHP support
Shopping cart online validation i.e. how can we configure Paypal, etc.?
Answers :Nothing more we have to do only redirect to the payPal url after submit
all information needed by paypal like amount,adresss etc.
What is meant by nl2br()?
Inserts HTML line breaks (
) before all newlines in a string.
What is PHP Requirements?
ANS: HTML, CSS, Javascript, Jquery, Mysql, Bootstrap, database Handling Server Manage PHP.
a web host with PHP and MySQL support
Installation a web server on your own PC, and then install PHP and MySQL
What Is the Use Of PHP?
PHP Is Used For PHP Web Development We have Created with Website Functionality Like Dynamic content, CMS, Web site Form Handling, Read Write, Open Close File, Function Module Design, Encrypt Data, Add Delete Update Fetch Data.
Why I Select Php For Web Development?
PHP is a Wide World Language, Currently, PHP 8.0 Version Launch in 2021, Php Biggest Language For Web Development Filed, According To WWW PHP Websites In the World 60% Website Are Used PHP Language Backend Design.
PHP Is Very Fast other Then Languages
PHP Smart Language error Handling
PHP Easy To Connect With Other HTML, CSS, Javascript.
What Are Php String Functions?
- echo() Outputs one or more strings
- explode() Breaks a Str into an array
- crc32() Calculates a 32-bit CRC for a string
- crypt() One-way Str hashing
- strtolower() Converts a Str to lowercase letters
- strtoupper() Converts a Str to uppercase letters
- strtr() Translates certain characters in a string
- substr() Returns a part of a string
- fprintf() Writes a formatted Str to a specified output stream
- get_html_translation_table() Returns the translation table used by htmlspecialchars() and htmlentities()
- htmlspecialchars() Converts some predefined characters to HTML entities
- implode() Returns a str from the elements of an array
- join() Alias of implode()
- addcslashes() The Returns a str with backslashes in front of the specified Char
- addslashes() Returns a str with backslashes in front of predefined Char
- bin2hex() Converts a str of ASCII characters to hexadecimal values
- chop() Removes whitespace or other characters from the right end of a string
- chr() Returns a character from a specified ASCII value
- chunk_split() Splits a str into a series of smaller parts
- convert_cyr_string() Converts a Str from one Cyrillic character-set to another
- convert_uudecode() Decodes a uuencoded string
- convert_uuencode() Encodes a Str using the uuencode algorithm
- count_chars() Returns information about characters used in a string
- hebrev() Converts Hebrew text to visual text
- hebrevc() Converts Hebrew text to visual text and new lines (\n) into
- hex2bin() Converts a Str of hexadecimal values to ASCII characters
- html_entity_decode() Converts HTML entities to characters
- htmlentities() Converts characters to HTML entities
- htmlspecialchars_decode() Converts some predefined HTML entities to characters
- lcfirst() Converts the first character of a Str to lowercase
- levenshtein() Returns the Levenshtein distance between two strings
- localeconv() Returns locale numeric and monetary formatting information
- ltrim() Removes whitespace or other characters from the left side of a string
- md5() Calculates the MD5 hash of a string
- md5_file() Calculates the MD5 hash of a file
- metaphone() Calculates the metaphone key of a string
- money_format() Returns a Str formatted as a currency string
- nl_langinfo() Returns specific local information
- nl2br() Inserts HTML line breaks in front of each newline in a string
- number_format() Formats a number with grouped thousands
- ord() Returns the ASCII value of the first character of a string
- parse_str() Parses a query Str into variables
- print() Outputs one or more strings
- printf() Outputs a formatted string
- quoted_printable_decode() Converts a quoted-printable Str to an 8-bit string
- quoted_printable_encode() Converts an 8-bit Str to a quoted printable string
- quotemeta() Quotes meta characters
- rtrim() Removes whitespace or other characters from the right side of a string
- setlocale() Sets locale information
- sha1() Calculates the SHA-1 hash of a string
- sha1_file() Calculates the SHA-1 hash of a file
- similar_text() Calculates the similarity between two strings
- soundex() Calculates the soundex key of a string
- sprintf() Writes a formatted Str to a variable
- sscanf() Parses input from a Str according to a format
- str_getcsv() Parses a CSV Str into an array
- str_ireplace() Replaces some characters in a Str (case-insensitive)
- str_pad() Pads a Str to a new length
- str_repeat() Repeats a Str a specified number of times
- str_replace() Replaces some characters in a Str (case-sensitive)
- str_rot13() Performs the ROT13 encoding on a string
- str_shuffle() Randomly shuffles all characters in a string
- str_split() Splits a Str into an array
- str_word_count() Count the number of words in a string
- strcasecmp() Compares two strings (case-insensitive)
- strchr() Finds the first occurrence of a Str inside another Str (alias of strstr())
- strcmp() Compares two strings (case-sensitive)
- strcoll() Compares two strings (locale based Str comparison)
- strcspn() Returns the number of characters found in a Str before any part of some specified characters are found
- strip_tags() Strips HTML and PHP tags from a string
- stripcslashes() Unquotes a Str quoted with addcslashes()
- stripslashes() Unquotes a Str quoted with addslashes()
- stripos() Returns the position of the first occurrence of a Str inside another Str (case-insensitive)
- stristr() Finds the first occurrence of a Str inside another Str (case-insensitive)
- strlen() Returns the length of a string
- strnatcasecmp() Compares two strings using a "natural order" algorithm (case-insensitive)
- strnatcmp() Compares two strings using a "natural order" algorithm (case-sensitive)
- strncasecmp() Str comparison of the first n characters (case-insensitive)
- strncmp() Str comparison of the first n characters (case-sensitive)
- strpbrk() Searches a Str for any of a set of characters
- strpos() Returns the position of the first occurrence of a Str inside another Str (case-sensitive)
- strrchr() Finds the last occurrence of a Str inside another string
- strrev() Reverses a string
- strripos() Finds the position of the last occurrence of a Str inside another Str (case-insensitive)
- strrpos() Finds the position of the last occurrence of a Str inside another Str (case-sensitive)
- strspn() Returns the number of characters found in a Str that contains only characters from a specified charlist
- strstr() Finds the first occurrence of a Str inside another Str (case-sensitive)
- strtok() Splits a Str into smaller strings
- substr_compare() Compares two strings from a specified start position (binary safe and optionally case-sensitive)
- vprintf() Outputs a formatted string
- vsprintf() Writes a formatted Str to a variable
- wordwrap() Wraps a Str to a given number of characters
- substr_count() Counts the number of times a subStr occurs in a string
- substr_replace() Replaces a part of a Str with another string
- trim() Removes whitespace or other characters from both sides of a string
- ucfirst() Converts the first character of a Str to uppercase
- ucwords() Converts the first character of each word in a Str to uppercase
- vfprintf() Writes a formatted Str to a specified output stream
What are The PHP arr Functions?
- array() Creates an array
- array_change_key_case() Changes all key in an arr to lowercase or uppercase
- array_chunk() Splits an arr into chunks of arrays
- array_column() Returns the values from a single column in the input array
- array_combine() Creates an arr by using the elements from one "keys" arr and one "values" array
- array_count_values() Counts all the values of an array
- array_diff() Compare arrays, and returns the differences (compare values only)
- array_diff_assoc() Compare arrays, and returns the differences (compare key and values)
- array_diff_key() Compare arrays, and returns the differences (compare key only)
- array_diff_uassoc() Compare arrays, and returns the differences (compare key and values, using a user-defined key comparison function)
- array_diff_ukey() Compare arrays, and returns the differences (compare key only, using a user-defined key comparison function)
- array_fill() Fills an arr with values
- array_fill_keys() Fills an arr with values, specifying keys
- array_filter() Filters the values of an arr using a callback function
- array_flip() Flips/Exchanges all key with their associated values in an array
- array_intersect() Compare arrays, and returns the matches (compare values only)
- array_intersect_assoc() Compare arrays and returns the matches (compare key and values)
- array_intersect_key() Compare arrays, and returns the matches (compare key only)
- array_intersect_uassoc() Compare arrays, and returns the matches (compare key and values, using a user-defined key comparison function)
- array_intersect_ukey() Compare arrays, and returns the matches (compare key only, using a user-defined key comparison function)
- array_key_exists() Checks if the specified key exists in the array
- array_keys() Returns all the key of an array
- array_map() Sends each value of an arr to a user-made function, which returns new values
- array_merge() Merges one or more arrays into one array
- array_merge_recursive() Merges one or more arrays into one arr recursively
- array_multisort() Sorts multiple or multi-dimensional arrays
- array_pad() Inserts a specified number of items, with a specified value, to an array
- array_pop() Deletes the last element of an array
- array_product() Calculates the product of the values in an array
- array_push() Inserts one or more elements to the end of an array
- array_rand() Returns one or more random key from an array
- array_reduce() Returns an arr as a string, using a user-defined function
- array_replace() Replaces the values of the first arr with the values from following arrays
- array_replace_recursive() Replaces the values of the first arr with the values from following arrays recursively
- array_reverse() Returns an arr in the reverse order
- array_search() Searches an arr for a given value and returns the key
- array_shift() Removes the first element from an array, and returns the value of the removed element
- array_slice() Returns selected parts of an array
- array_splice() Removes and replaces specified elements of an array
- array_sum() Returns the sum of the values in an array
- array_udiff() Compare arrays, and returns the differences (compare values only, using a user-defined key comparison function)
- array_udiff_assoc() Compare arrays, and returns the differences (compare key and values, using a built-in function to compare the key and a user-defined function to compare the values)
- array_udiff_uassoc() Compare arrays, and returns the differences (compare key and values, using two user-defined key comparison functions)
- array_uintersect() Compare arrays, and returns the matches (compare values only, using a user-defined key comparison function)
- array_uintersect_assoc() Compare arrays, and returns the matches (compare key and values, using a built-in function to compare the key and a user-defined function to compare the values)
- array_uintersect_uassoc() Compare arrays, and returns the matches (compare key and values, using two user-defined key comparison functions)
- array_unique() Removes duplicate values from an array
- array_unshift() Adds one or more elements to the beginning of an array
- array_values() Returns all the values of an array
- array_walk() Applies a user function to every member of an array
- array_walk_recursive() Applies a user function recursively to every member of an array
- arsort() Sorts an associative arr in descending order, according to the value
- asort() Sorts an associative arr in ascending order, according to the value
- compact() Create arr containing variables and their values
- count() Returns the number of elements in an array
- current() Returns the current element in an array
- each() Deprecated from PHP 7.2. Returns the current key and value pair from an array
- end() Sets the internal pointer of an arr to its last element
- extract() Imports variables into the current symbol table from an array
- in_array() Checks if a specified value exists in an array
- key() Fetches a key from an array
- krsort() Sorts an associative arr in descending order, according to the key
- ksort() Sorts an associative arr in ascending order, according to the key
- list() Assigns variables as if they were an array
- natcasesort() Sorts an arr using a case insensitive "natural order" algorithm
- natsort() Sorts an arr using a "natural order" algorithm
- next() Advance the internal arr pointer of an array
- pos() Alias of current()
- prev() Rewinds the internal arr pointer
- range() Creates an arr containing a range of elements
- reset() Sets the internal pointer of an arr to its first element
- rsort() Sorts an indexed arr in descending order
- shuffle() Shuffles an array
- sizeof() Alias of count()
- sort() Sorts an indexed arr in ascending order
- uasort() Sorts an arr by values using a user-defined comparison function
- uksort() Sorts an arr by key using a user-defined comparison function
- usort() Sorts an arr using a user-defined comparison function
What Are the Date Function in PHP?
- checkdate() Validates a Gregorian date
- date_add() Adds days, months, years, hours, minutes, and seconds to a date
- date_create_from_format() Return a new DateTime object formatted according to a specified format
- date_create() Return a new DateTime object
- date_date_set() Sets a new date
- date_default_timezone_get() Return the default timezone used by all date/time functions
- date_default_timezone_set() Sets the default timezone used by all date/time functions
- date_diff() Return the difference between two dates
- date_format() Return a date formatted according to a specified format
- date_get_last_errors() Return the warnings/errors found in a date string
- date_interval_create_from_date_string() Sets up a DateInterval from the relative parts of the string
- date_interval_format() Formats the interval
- date_isodate_set() Sets the ISO date
- date_modify() Modifies the timestamp
- date_offset_get() Return the timezone offset
- date_parse_from_format() Return an associative array with detailed info about a specified date, according to a specified format
- date_parse() Return an associative array with detailed info about a specified date
- date_sub() Subtracts days, months, years, hours, minutes, and seconds from a date
- date_sun_info() Return an array containing info about sunset/sunrise and twilight begin/end, for a specified day and location
- date_sunrise() Return the sunrise time for a specified day and location
- date_sunset() Return the sunset time for a specified day and location
- date_time_set() Sets the time
- date_timestamp_get() Return the Unix timestamp
- date_timestamp_set() Sets the date and time based on a Unix
- date_timezone_get() Return the time zone of the given DateTime object
- date_timezone_set() Sets the time zone for the DateTime object
- date() Formats a local date and time
- getdate() Return date/time information of a timestamp or the current local date/time
- gettimeofday() Return the current time
- gmdate() Formats a GMT/UTC date and time
- gmmktime() Return the Unix timestamp for a GMT date
- gmstrftime() Formats a GMT/UTC date and time according to locale settings
- idate() Formats a local time/date as integer
- localtime() Return the local time
- microtime() Return the current Unix timestamp with microseconds
- mktime() Return the Unix timestamp for a date
- strftime() Formats a local time and/or date according to locale settings
- strptime() Parses a time/date generated with strftime()
- strtotime() Parses an English textual datetime into a Unix timestamp
- time() Return the current time as a Unix timestamp
- timezone_abbreviations_list() Return an associative array containing dst, offset, and the timezone name
- timezone_identifiers_list() Return an indexed array with all timezone identifiers
- timezone_location_get() Return location information for a specified timezone
- timezone_name_from_ abbr() Return the timezone name from abbreviation
- timezone_name_get() Return the name of the timezone
- timezone_offset_get() Return the timezone offset from GMT
- timezone_open() Creates new DateTimeZone object
- timezone_transitions_get() Return all transitions for the timezone
- timezone_version_get() Return the version of the timezonedb
Most Using Functions In php?
- count
- is_array
- substr
- in_array
- explode
- str_replace
- implode
- strlen
- strpos
- preg_match
- sprintf
- trim
- strtolower
- file_exists
- is_string
- preg_replace
- file_get_contents
- array_key_exists
- array_keys
- dirname
- function_exists
- array_map
- get_class
- class_exists
- is_object
- time
- json_encode
- date
- is_null
- is_numeric
- array_shift
- defined
- is_dir
- json_decode
- header
- strtoupper
- array_values
- md5
- method_exists
- file_put_contents
- rtrim
- array_pop
- unlink
- basename
- realpath
- call_user_func
- call_user_func_array
- fopen
- microtime
- fclose
- is_int
- is_file
- array_slice
- preg_match_all
- intval
- str_repeat
- serialize
- array_filter
- mkdir
- is_callable
- ltrim
- ob_start
- round
- fwrite
- array_unique
- array_search
- reset
- array_unshift
- parse_url
- func_get_args
- end
- base64_encode
- unserialize
- max
- preg_split
- gettype
- strrpos
- version_compare
- array_push
- floor
- strtotime
- htmlspecialchars
- ini_get
- ini_set
- chr
- extension_loaded
- is_bool
- ksort
- array_reverse
- ord
- uniqid
- strtr
- array_diff
- error_reporting
- ceil
- urlencode
- min
- print_r