Sunday, September 23, 2007

php interview questions and answers

1. What are the differences between GET and POST methods in form submitting, give the case where we can use get and we can use post methods?
Answer:
On the server side, the main difference between GET and POST is where the submitted is stored. The $_GET array stores data submitted by the GET method. The $_POST array stores data submitted by the POST method.
On the browser side, the difference is that data submitted by the GET method will be displayed in the browser's address field. Data submitted by the POST method will not be displayed anywhere on the browser.
GET method is mostly used for submitting a small amount and less sensitive data. POST method is mostly used for submitting a large amount or sensitive data.


2. Who is the father of php and explain the changes in php versions?

Answer:
Rasmus Lerdorf for version changes go to http://php.net/
Marco Tabini is the founder and publisher of php|architect.

3. How can we submit from without a submit button?
Answer:
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:

4. How many ways we can retrieve the date in result set of mysql Using php?
Answer:
As individual objects so single record or as a set or arrays.

php questions

link -- Create a hard link

linkinfo -- Gets information about a link

lstat -- Gives information about a file or symbolic link

mkdir -- Makes directory

move_uploaded_file -- Moves an uploaded file to a new location

parse_ini_file -- Parse a configuration file

pathinfo -- Returns information about a file path

pclose -- Closes process file pointer

popen -- Opens process file pointer

readfile -- Outputs a file

readlink -- Returns the target of a symbolic link

realpath -- Returns canonicalized absolute pathname

rename -- Renames a file or directory

rewind -- Rewind the position of a file pointer

rmdir -- Removes directory

set_file_buffer -- Alias of stream_set_write_buffer()

stat -- Gives information about a file

symlink -- Creates a symbolic link

tempnam -- Create file with unique file name

tmpfile -- Creates a temporary file

touch -- Sets access and modification time of file

umask -- Changes the current umask

unlink -- Deletes a file





1.what is oops?







Types of arrays:

• Numerically indexed arrays

• Associative arrays

• Multidimensional arrays

• Sorting arrays

php question

basename -- Returns filename component of path

chgrp -- Changes file group

chmod -- Changes file mode

chown -- Changes file owner

clearstatcache -- Clears file status cache

copy -- Copies file

delete -- See unlink() or unset()

dirname -- Returns directory name component of path

disk_free_space -- Returns available space in directory

disk_total_space -- Returns the total size of a directory

diskfreespace -- Alias of disk_free_space()

fclose -- Closes an open file pointer

feof -- Tests for end-of-file on a file pointer

fflush -- Flushes the output to a file

fgetc -- Gets character from file pointer

fgetcsv -- Gets line from file pointer and parse for CSV fields

fgets -- Gets line from file pointer

fgetss -- Gets line from file pointer and strip HTML tags

file_exists -- Checks whether a file or directory exists

file_get_contents -- Reads entire file into a string

file_put_contents -- Write a string to a file

file -- Reads entire file into an array

fileatime -- Gets last access time of file

filectime -- Gets inode change time of file

filegroup -- Gets file group

fileinode -- Gets file inode

filemtime -- Gets file modification time

fileowner -- Gets file owner

fileperms -- Gets file permissions

filesize -- Gets file size

filetype -- Gets file type

flock -- Portable advisory file locking

fnmatch -- Match filename against a pattern

fopen -- Opens file or URL

fpassthru -- Output all remaining data on a file pointer

fputcsv -- Format line as CSV and write to file pointer

fputs -- Alias of fwrite()

fread -- Binary-safe file read

fscanf -- Parses input from a file according to a format

fseek -- Seeks on a file pointer

fstat -- Gets information about a file using an open file pointer

ftell -- Tells file pointer read/write position

ftruncate -- Truncates a file to a given length

fwrite -- Binary-safe file write

glob -- Find pathnames matching a pattern

is_dir -- Tells whether the filename is a directory

is_executable -- Tells whether the filename is executable

is_file -- Tells whether the filename is a regular file

is_link -- Tells whether the filename is a symbolic link

is_readable -- Tells whether the filename is readable

is_uploaded_file -- Tells whether the file was uploaded via HTTP POST

is_writable -- Tells whether the filename is writable

is_writeable -- Alias of is_writable()

php interview question

wordwrap -- Wraps a string to a given number of characters using a string break character





debug_zval_dump -- Dumps a string representation of an internal zend value to output

doubleval -- Alias of floatval()

empty -- Determine whether a variable is empty

floatval -- Get float value of a variable

get_defined_vars -- Returns an array of all defined variables

get_resource_type -- Returns the resource type

gettype -- Get the type of a variable

import_request_variables -- Import GET/POST/Cookie variables into the global scope

intval -- Get integer value of a variable

is_array -- Finds whether a variable is an array

is_bool -- Finds out whether a variable is a boolean

is_callable -- Verify that the contents of a variable can be called as a function

is_double -- Alias of is_float()

is_float -- Finds whether a variable is a float

is_int -- Find whether a variable is an integer

is_integer -- Alias of is_int()

is_long -- Alias of is_int()

is_null -- Finds whether a variable is NULL

is_numeric -- Finds whether a variable is a number or a numeric string

is_object -- Finds whether a variable is an object

is_real -- Alias of is_float()

is_resource -- Finds whether a variable is a resource

is_scalar -- Finds whether a variable is a scalar

is_string -- Finds whether a variable is a string

isset -- Determine whether a variable is set

print_r -- Prints human-readable information about a variable

serialize -- Generates a storable representation of a value

settype -- Set the type of a variable

strval -- Get string value of a variable

unserialize -- Creates a PHP value from a stored representation

unset -- Unset a given variable

var_dump -- Dumps information about a variable

var_export -- Outputs or returns a parsable string representation of a variable

php interview questions

addcslashes -- Quote string with slashes in a C style

addslashes -- Quote string with slashes

bin2hex -- Convert binary data into hexadecimal representation

chop -- Alias of rtrim()

chr -- Return a specific character

chunk_split -- Split a string into smaller chunks

convert_cyr_string -- Convert from one Cyrillic character set to another

convert_uudecode -- Decode a uuencoded string

convert_uuencode -- Uuencode a string

count_chars -- Return information about characters used in a string

crc32 -- Calculates the crc32 polynomial of a string

crypt -- One-way string encryption (hashing)

echo -- Output one or more strings

explode -- Split a string by string

fprintf -- Write a formatted string to a stream

get_html_translation_table -- Returns the translation table used by htmlspecialchars() and htmlentities()

hebrev -- Convert logical Hebrew text to visual text

hebrevc -- Convert logical Hebrew text to visual text with newline conversion

html_entity_decode -- Convert all HTML entities to their applicable characters

htmlentities -- Convert all applicable characters to HTML entities

htmlspecialchars -- Convert special characters to HTML entities

implode -- Join array elements with a string

join -- Alias of implode()

levenshtein -- Calculate Levenshtein distance between two strings

localeconv -- Get numeric formatting information

ltrim -- Strip whitespace (or other characters) from the beginning of a string

md5_file -- Calculates the md5 hash of a given file

md5 -- Calculate the md5 hash of a string

metaphone -- Calculate the metaphone key of a string

money_format -- Formats a number as a currency string

nl_langinfo -- Query language and locale information

nl2br -- Inserts HTML line breaks before all newlines in a string

number_format -- Format a number with grouped thousands

ord -- Return ASCII value of character

parse_str -- Parses the string into variables

print -- Output a string

printf -- Output a formatted string

quoted_printable_decode -- Convert a quoted-printable string to an 8 bit string

quotemeta -- Quote meta characters

rtrim -- Strip whitespace (or other characters) from the end of a string

setlocale -- Set locale information

sha1_file -- Calculate the sha1 hash of a file

sha1 -- Calculate the sha1 hash of a string

similar_text -- Calculate the similarity between two strings

soundex -- Calculate the soundex key of a string

sprintf -- Return a formatted string

sscanf -- Parses input from a string according to a format

str_ireplace -- Case-insensitive version of str_replace().

str_pad -- Pad a string to a certain length with another string

str_repeat -- Repeat a string

str_replace -- Replace all occurrences of the search string with the replacement string

str_rot13 -- Perform the rot13 transform on a string

str_shuffle -- Randomly shuffles a string

str_split -- Convert a string to an array

str_word_count -- Return information about words used in a string

strcasecmp -- Binary safe case-insensitive string comparison

strchr -- Alias of strstr()

strcmp -- Binary safe string comparison

strcoll -- Locale based string comparison

strcspn -- Find length of initial segment not matching mask

strip_tags -- Strip HTML and PHP tags from a string

stripcslashes -- Un-quote string quoted with addcslashes()

stripos -- Find position of first occurrence of a case-insensitive string

stripslashes -- Un-quote string quoted with addslashes()

stristr -- Case-insensitive strstr()

strlen -- Get string length

strnatcasecmp -- Case insensitive string comparisons using a "natural order" algorithm

strnatcmp -- String comparisons using a "natural order" algorithm

strncasecmp -- Binary safe case-insensitive string comparison of the first n characters

strncmp -- Binary safe string comparison of the first n characters

strpbrk -- Search a string for any of a set of characters

strpos -- Find position of first occurrence of a string

strrchr -- Find the last occurrence of a character in a string

strrev -- Reverse a string

strripos -- Find position of last occurrence of a case-insensitive string in a string

strrpos -- Find position of last occurrence of a char in a string

strspn -- Find length of initial segment matching mask

strstr -- Find first occurrence of a string

strtok -- Tokenize string

strtolower -- Make a string lowercase

strtoupper -- Make a string uppercase

strtr -- Translate certain characters

substr_compare -- Binary safe optionally case insensitive comparison of 2 strings from an offset, up to length characters

substr_count -- Count the number of substring occurrences

substr_replace -- Replace text within a portion of a string

substr -- Return part of a string

trim -- Strip whitespace (or other characters) from the beginning and end of a string

ucfirst -- Make a string's first character uppercase

ucwords -- Uppercase the first character of each word in a string

vfprintf -- Write a formatted string to a stream

vprintf -- Output a formatted string

vsprintf -- Return a formatted string

php session related question

Session Functions:

session_cache_expire -- Return current cache expire

session_cache_limiter -- Get and/or set the current cache limiter

session_commit -- Alias of session_write_close()

session_decode -- Decodes session data from a string

session_destroy -- Destroys all data registered to a session

session_encode -- Encodes the current session data as a string

session_get_cookie_params -- Get the session cookie parameters

session_id -- Get and/or set the current session id

session_is_registered -- Find out whether a global variable is registered in a session

session_module_name -- Get and/or set the current session module

session_name -- Get and/or set the current session name

session_regenerate_id -- Update the current session id with a newly generated one

session_register -- Register one or more global variables with the current session

session_save_path -- Get and/or set the current session save path

session_set_cookie_params -- Set the session cookie parameters

session_set_save_handler -- Sets user-level session storage functions

session_start -- Initialize session data

session_unregister -- Unregister a global variable from the current session

session_unset -- Free all session variables

session_write_close -- Write session data and end session

php pattern mathing related question

Pattern Modifiers -- Describes possible modifiers in regex patterns

Pattern Syntax -- Describes PCRE regex syntax

preg_grep -- Return array entries that match the pattern

preg_match_all -- Perform a global regular expression match

preg_match -- Perform a regular expression match

preg_quote -- Quote regular expression characters

preg_replace_callback -- Perform a regular expression search and replace using a callback

preg_replace -- Perform a regular expression search and replace

preg_split -- Split string by a regular expression



ereg_replace -- Replace regular expression

ereg -- Regular expression match

eregi_replace -- Replace regular expression case insensitive

eregi -- Case insensitive regular expression match

split -- Split string into array by regular expression

spliti -- Split string into array by regular expression case insensitive

sql_regcase -- Make regular expression for case insensitive match

php interview questions

flush -- Flush the output buffer

ob_clean -- Clean (erase) the output buffer

ob_end_clean -- Clean (erase) the output buffer and turn off output buffering

ob_end_flush -- Flush (send) the output buffer and turn off output buffering

ob_flush -- Flush (send) the output buffer

ob_get_clean -- Get current buffer contents and delete current output buffer

ob_get_contents -- Return the contents of the output buffer

ob_get_flush -- Flush the output buffer, return it as a string and turn off output buffering

ob_get_length -- Return the length of the output buffer

ob_get_level -- Return the nesting level of the output buffering mechanism

ob_get_status -- Get status of output buffers

ob_gzhandler -- ob_start callback function to gzip output buffer

ob_implicit_flush -- Turn implicit flush on/off

ob_list_handlers -- List all output handlers in use

ob_start -- Turn on output buffering

output_add_rewrite_var -- Add URL rewriter values

output_reset_rewrite_vars -- Reset URL rewriter values

php mysql interview questions

Mysql Functions:

mysql_affected_rows -- Get number of affected rows in previous MySQL operation

mysql_change_user -- Change logged in user of the active connection

mysql_client_encoding -- Returns the name of the character set

mysql_close -- Close MySQL connection

mysql_connect -- Open a connection to a MySQL Server

mysql_create_db -- Create a MySQL database

mysql_data_seek -- Move internal result pointer

mysql_db_name -- Get result data

mysql_db_query -- Send a MySQL query

mysql_drop_db -- Drop (delete) a MySQL database

mysql_errno -- Returns the numerical value of the error message from previous MySQL operation

mysql_error -- Returns the text of the error message from previous MySQL operation

mysql_escape_string -- Escapes a string for use in a mysql_query

mysql_fetch_array -- Fetch a result row as an associative array, a numeric array, or both

mysql_fetch_assoc -- Fetch a result row as an associative array

mysql_fetch_field -- Get column information from a result and return as an object

mysql_fetch_lengths -- Get the length of each output in a result

mysql_fetch_object -- Fetch a result row as an object

mysql_fetch_row -- Get a result row as an enumerated array

mysql_field_flags -- Get the flags associated with the specified field in a result

mysql_field_len -- Returns the length of the specified field

mysql_field_name -- Get the name of the specified field in a result

mysql_field_seek -- Set result pointer to a specified field offset

mysql_field_table -- Get name of the table the specified field is in

mysql_field_type -- Get the type of the specified field in a result

mysql_free_result -- Free result memory

mysql_get_client_info -- Get MySQL client info

mysql_get_host_info -- Get MySQL host info

mysql_get_proto_info -- Get MySQL protocol info

mysql_get_server_info -- Get MySQL server info

mysql_info -- Get information about the most recent query

mysql_insert_id -- Get the ID generated from the previous INSERT operation

mysql_list_dbs -- List databases available on a MySQL server

mysql_list_fields -- List MySQL table fields

mysql_list_processes -- List MySQL processes

mysql_list_tables -- List tables in a MySQL database

mysql_num_fields -- Get number of fields in result

mysql_num_rows -- Get number of rows in result

mysql_pconnect -- Open a persistent connection to a MySQL server

mysql_ping -- Ping a server connection or reconnect if there is no connection

mysql_query -- Send a MySQL query

mysql_real_escape_string -- Escapes special characters in a string for use in a SQL statement

mysql_result -- Get result data

mysql_select_db -- Select a MySQL database

mysql_stat -- Get current system status

mysql_tablename -- Get table name of field

mysql_thread_id -- Return the current thread ID

mysql_unbuffered_query -- Send an SQL query to MySQL, without fetching and buffering the result rows.

php predefiend constants

Predefined constants:

connection_aborted -- Returns TRUE if client disconnected

connection_status -- Returns connection status bitfield

connection_timeout -- Return TRUE if script timed out

constant -- Returns the value of a constant

define -- Defines a named constant

defined -- Checks whether a given named constant exists

die -- Equivalent to exit()

eval -- Evaluate a string as PHP code

exit -- Output a message and terminate the current script

get_browser -- Tells what the user's browser is capable of

highlight_file -- Syntax highlighting of a file

highlight_string -- Syntax highlighting of a string

ignore_user_abort -- Set whether a client disconnect should abort script execution

pack -- Pack data into binary string

php_check_syntax -- Check the PHP syntax of (and execute) the specified file

php_strip_whitespace -- Return source with stripped comments and whitespace

show_source -- Alias of highlight_file()

sleep -- Delay execution

time_nanosleep -- Delay for a number of seconds and nanoseconds

uniqid -- Generate a unique ID

unpack -- Unpack data from binary string

usleep -- Delay execution in microseconds

php header functions

Header functions:

header -- Send a raw HTTP header

headers_list -- Returns a list of response headers sent (or ready to send)

headers_sent -- Checks if or where headers have been sent

setcookie -- Send a cookie

setrawcookie -- Send a cookie without urlencoding the cookie value

php array functions

Array functions:

array_change_key_case -- Returns an array with all string keys lowercased or uppercased

array_chunk -- Split an array into chunks

array_combine -- Creates an array by using one array for keys and another for its values

array_count_values -- Counts all the values of an array

array_diff_assoc -- Computes the difference of arrays with additional index check

array_diff_key -- Computes the difference of arrays using keys for comparison

array_diff_uassoc -- Computes the difference of arrays with additional index check which is performed by a user supplied callback function

array_diff_ukey -- Computes the difference of arrays using a callback function on the keys for comparison

array_diff -- Computes the difference of arrays

array_fill -- Fill an array with values

array_filter -- Filters elements of an array using a callback function

array_flip -- Exchanges all keys with their associated values in an array

array_intersect_assoc -- Computes the intersection of arrays with additional index check

array_intersect_key -- Computes the intersection of arrays using keys for comparison

array_intersect_uassoc -- Computes the intersection of arrays with additional index check, compares indexes by a callback function

array_intersect_ukey -- Computes the intersection of arrays using a callback function on the keys for comparison

array_intersect -- Computes the intersection of arrays

array_key_exists -- Checks if the given key or index exists in the array

array_keys -- Return all the keys of an array

array_map -- Applies the callback to the elements of the given arrays

array_merge_recursive -- Merge two or more arrays recursively

array_merge -- Merge one or more arrays

array_multisort -- Sort multiple or multi-dimensional arrays

array_pad -- Pad array to the specified length with a value

array_pop -- Pop the element off the end of array

array_push -- Push one or more elements onto the end of array

array_rand -- Pick one or more random entries out of an array

array_reduce -- Iteratively reduce the array to a single value using a callback function

array_reverse -- Return an array with elements in reverse order

array_search -- Searches the array for a given value and returns the corresponding key if successful

array_shift -- Shift an element off the beginning of array

array_slice -- Extract a slice of the array

array_splice -- Remove a portion of the array and replace it with something else

array_sum -- Calculate the sum of values in an array

array_udiff_assoc -- Computes the difference of arrays with additional index check, compares data by a callback function

array_udiff_uassoc -- Computes the difference of arrays with additional index check, compares data and indexes by a callback function

array_udiff -- Computes the difference of arrays by using a callback function for data comparison

array_uintersect_assoc -- Computes the intersection of arrays with additional index check, compares data by a callback function

array_uintersect_uassoc -- Computes the intersection of arrays with additional index check, compares data and indexes by a callback functions

array_uintersect -- Computes the intersection of arrays, compares data by a callback function

array_unique -- Removes duplicate values from an array

array_unshift -- Prepend one or more elements to the beginning of an array

array_values -- Return all the values of an array

array_walk_recursive -- Apply a user function recursively to every member of an array

array_walk -- Apply a user function to every member of an array

array -- Create an array

arsort -- Sort an array in reverse order and maintain index association

asort -- Sort an array and maintain index association

compact -- Create array containing variables and their values

count -- Count elements in an array, or properties in an object

current -- Return the current element in an array

each -- Return the current key and value pair from an array and advance the array cursor

end -- Set the internal pointer of an array to its last element

extract -- Import variables into the current symbol table from an array

in_array -- Checks if a value exists in an array

key -- Fetch a key from an associative array

krsort -- Sort an array by key in reverse order

ksort -- Sort an array by key

list -- Assign variables as if they were an array

natcasesort -- Sort an array using a case insensitive "natural order" algorithm

natsort -- Sort an array using a "natural order" algorithm

next -- Advance the internal array pointer of an array

pos -- Alias of current()

prev -- Rewind the internal array pointer

range -- Create an array containing a range of elements

reset -- Set the internal pointer of an array to its first element

rsort -- Sort an array in reverse order

shuffle -- Shuffle an array

sizeof -- Alias of count()

sort -- Sort an array

uasort -- Sort an array with a user-defined comparison function and maintain index association

uksort -- Sort an array by keys using a user-defined comparison function

usort -- Sort an array by values using a user-defined comparison function

php interview questions

Cookies:

PHP transparently supports HTTP cookies as defined by Netscape's Spec. Cookies are a mechanism for storing data in the remote browser and thus tracking or identifying return users. You can set cookies using the setcookie() function. Cookies are part of the HTTP header, so the SetCookie function must be called before any output is sent to the browser. This is the same restriction as for the header() function. Cookie data is then available in the appropriate cookie data arrays, such as $_COOKIE, $HTTP_COOKIE_VARS as well as in $_REQUEST.

Syn:

bool setcookie ( string name [, string value [, int expire [, string path [, string domain [, bool secure]]]]] )



Magic constants

There are five magical constants that change depending on where they are used. For example, the value of __LINE__ depends on the line that it's used on in your script. These special constants are case-insensitive and are as follows:

Table 13-1. A few "magical" PHP constants

Name Description

__LINE__ The current line number of the file.

__FILE__ The full path and filename of the file. If used inside an include, the name of the included file is returned.

__FUNCTION__ The function name. (Added in PHP 4.3.0) As of PHP 5 this constant returns the function name as it was declared (case-sensitive). In PHP 4 its value is always lowercased.

__CLASS__ The class name. (Added in PHP 4.3.0) As of PHP 5 this constant returns the class name as it was declared (case-sensitive). In PHP 4 its value is always lowercased.

__METHOD__ The class method name. (Added in PHP 5.0.0) The method name is returned as it was declared (case-sensitive).

php interview questions

Primary key:

A primary key is a unique identifier that has to abide by certain rules. They must

• Always have a value (it cannot be NULL)

• Have a value that remains the same (never changes)

• Have a unique value for each record in the table

27. Forign key:

Foreign keys are the representation of the primary key from Table A in Table B

php interview questions

1.what is oops?

2.what are new in php5?

3.what are new in mysql5?

4.what is the difference between include and require?

5.what is the difference between unique and primary key?

6.what are primary and foreign key?

7.what is the difference between group by and order by?

8.what is the difference between mysql_connect() and mysql_pconncect()?

9.what is the default php script execution time(30 sec) and upload file size(2 Mb bytes), post form (8 M)size?

10.what is array?

11.Some array functions and string functions?

12.what is magic constants?

13.what is normalization?

15.what are think u will consider, when u design the table?

16.what are the difference between GET and POST methods?

17.To upload a file what parameter we have to add in the form tag?

18.How do u connect the script with the database?

19.What is maximum table size and maximum row size in mysql?

20.what are session and cookies and what is the difference between session and cookies?

21.what is indexing?

22.what is the difference between delete table and truncate table?

23.Maximum length for mysql table, column name – 64 characters.

24. MySQL: Maximum number of columns in one table - 3398; size of a table row - 65534 (BLOB and TEXT not included).

25. MySQL: Number of tables - not limited, up to 32 indexes per table with 256 bytes maximum key length.

26.What is the difference between single quote(‘’) and double quote (“”)?

27. what is the difference between $var and $$var?

php 4 vs php5

• ibase_rollback_ret() - Rollback transaction and retain the transaction context
• ibase_server_info() - Request statistics about a database
• ibase_service_attach() - Connect to the service manager
• ibase_service_detach() - Disconnect from the service manager
• ibase_set_event_handler() - Register a callback function to be called when events are posted
• ibase_wait_event() - Wait for an event to be posted by the database
iconv:
• iconv_mime_decode() - Decodes a MIME header field
• iconv_mime_decode_headers() - Decodes multiple MIME header fields at once
• iconv_mime_encode() - Composes a MIME header field
• iconv_strlen() - Returns the character count of string
• iconv_strpos() - Finds position of first occurrence of a needle within a haystack
• iconv_strrpos() - Finds the last occurrence of a needle within a haystack
• iconv_substr() - Cut out part of a string
Streams:
• stream_copy_to_stream() - Copies data from one stream to another
• stream_get_line() - Gets line from stream resource up to a given delimiter
• stream_socket_accept() - Accept a connection on a socket created by stream_socket_server()
• stream_socket_client() - Open Internet or Unix domain socket connection
• stream_socket_get_name() - Retrieve the name of the local or remote sockets
• stream_socket_recvfrom() - Receives data from a socket, connected or not
• stream_socket_sendto() - Sends a message to a socket, whether it is connected or not
• stream_socket_server() - Create an Internet or Unix domain server socket
Date and time related:
• idate() - Format a local time/date as integer
• date_sunset() - Time of sunset for a given day and location
• date_sunrise() - Time of sunrise for a given day and location
• time_nanosleep() - Delay for a number of seconds and nanoseconds
Strings:
• str_split() - Convert a string to an array
• strpbrk() - Search a string for any of a set of characters
• substr_compare() - Binary safe optionally case insensitive comparison of two strings from an offset, up to length characters
Other:
• convert_uudecode() - decode a uuencoded string
• convert_uuencode() - uuencode a string
• curl_copy_handle() - Copy a cURL handle along with all of its preferences
• dba_key_split() - Splits a key in string representation into array representation
• dbase_get_header_info() - Get the header info of a dBase database
• dbx_fetch_row() - Fetches rows from a query-result that had the DBX_RESULT_UNBUFFERED flag set
• fbsql_set_password() - Change the password for a given user
• file_put_contents() - Write a string to a file
• ftp_alloc() - Allocates space for a file to be uploaded
• get_declared_interfaces() - Returns an array of all declared interfaces
• get_headers() - Fetches all the headers sent by the server in response to a HTTP request
• headers_list() - Returns a list of response headers sent (or ready to send)
• http_build_query() - Generate URL-encoded query string
• image_type_to_extension() - Get file extension for image-type returned by getimagesize(), exif_read_data(), exif_thumbnail(), exif_imagetype()
• imagefilter() - Applies a filter to an image using custom arguments
• imap_getacl() - Gets the ACL for a given mailbox
• ldap_sasl_bind() - Bind to LDAP directory using SASL
• mb_list_encodings() - Returns an array of all supported encodings
• pcntl_getpriority() - Get the priority of any process
• pcntl_wait() - Waits on or returns the status of a forked child as defined by the waitpid() system call
• pg_version() - Returns an array with client, protocol and server version (when available)
• php_check_syntax() - Check the syntax of the specified file
• php_strip_whitespace() - Return source with stripped comments and whitespace
• proc_nice() - Change the priority of the current process
• pspell_config_data_dir() - Change location of language data files
• pspell_config_dict_dir() - Change location of the main word list
• setrawcookie() - Send a cookie without URL-encoding the value
• scandir() - List files and directories inside the specified path
• snmp_read_mib() - Reads and parses a MIB file into the active MIB tree
• sqlite_fetch_column_types() - Return an array of column types from a particular table
4.New Directives
There were some new php.ini directives introduced in PHP 5. Here is a list of them:
• mail.force_extra_parameters - Force the addition of the specified parameters to be passed as extra parameters to the sendmail binary. These parameters will always replace the value of the 5th parameter to mail(), even in safe mode
• register_long_arrays - allow/disallow PHP to register the deprecated long $HTTP_*_VARS
• session.hash_function - select a hash function (MD5 or SHA-1)
• session.hash_bits_per_character - define how many bits are stored in each character when converting the binary hash data to something readable (from 4 to 6)
• zend.ze1_compatibility_mode - Enable compatibility mode with Zend Engine 1 (PHP 4)
5.Databases
There were some changes in PHP 5 regarding databases (MySQL and SQLite).
In PHP 5 the MySQL client libraries are not bundled, because of license problems and some others. .
There is also a new extension, MySQLi (Improved MySQL), which is designed to work with MySQL 4.1 and above.
Since PHP 5, the SQLite extension is built-in PHP. SQLite is an embeddable SQL database engine and is not a client library used to connect to a big database server (like MySQL or PostgreSQL). The SQLite library reads and writes directly to and from the database files on disk.
6.New Object Model
In PHP 5 there is a new Object Model. PHP's handling of objects has been completely rewritten, allowing for better performance and more features. In previous versions of PHP, objects were handled like primitive types (for instance integers and strings). The drawback of this method was that semantically the whole object was copied when a variable was assigned, or passed as a parameter to a method. In the new approach, objects are referenced by handle, and not by value (one can think of a handle as an object's identifier).
Many PHP programmers aren't even aware of the copying quirks of the old object model and, therefore, the majority of PHP applications will work out of the box, or with very few modifications
The new Object Model is documented at the http://www.php.net/manual/en/language.oop5.php
7.Error Reporting
As of PHP 5 new error reporting constant E_STRICT was introduced with value 2048. It enables run-time PHP suggestions on your code interoperability and forward compatibility, that will help you to keep latest and greatest suggested method of coding. E.g. STRICT message will warn you on using deprecated functions.
Note: E_ALL does not include E_STRICT so it's not enabled by default

difference between php and php5

1.What is changed between PHP 4 and PHP is the XML support?.

Two extensions have changed.
The XSLT extension present in PHP4 is not the XSL extension in PHP 5.
Additionally, the XML-DOM extension in PHP 4 is not the DOM extension
is PHP 5. What this means is that the syntax of the functions in these
extensions have changed but the purpose of the extensions has not
changed.

In PHP 4, objects were really just primitive data types, and were referenced by value. In an attempt to retain as much backward compatibility as possible, setting the zend.ze1_compatibility_mode in PHP 5 allows compatibility with the version 4 methods. There are a number of other backward incompatible changes. These include:

2.CLI and CGI:
In PHP 5 there were some changes in CLI and CGI filenames. In PHP 5, the CGI version was renamed to php-cgi.exe (previously php.exe) and the CLI version now sits in the main directory (previously cli/php.exe).
In PHP 5 it was also introduced a new mode: php-win.exe. This is equal to the CLI version, except that php-win doesn't output anything and thus provides no console (no "dos box" appears on the screen). This behavior is similar to php-gtk.
3.New Functions:
In PHP 5 there are some new functions. Here is the list of them:
Arrays:
• array_combine() - Creates an array by using one array for keys and another for its values
• array_diff_uassoc() - Computes the difference of arrays with additional index check which is performed by a user supplied callback function
• array_udiff() - Computes the difference of arrays by using a callback function for data comparison
• array_udiff_assoc() - Computes the difference of arrays with additional index check. The data is compared by using a callback function
• array_udiff_uassoc() - Computes the difference of arrays with additional index check. The data is compared by using a callback function. The index check is done by a callback function also
• array_walk_recursive() - Apply a user function recursively to every member of an array
• array_uintersect_assoc() - Computes the intersection of arrays with additional index check. The data is compared by using a callback function
• array_uintersect_uassoc() - Computes the intersection of arrays with additional index check. Both the data and the indexes are compared by using a callback functions
• array_uintersect() - Computes the intersection of arrays. The data is compared by using a callback function
InterBase:
• ibase_affected_rows() - Return the number of rows that were affected by the previous query
• ibase_backup() - Initiates a backup task in the service manager and returns immediately
• ibase_commit_ret() - Commit a transaction without closing it
• ibase_db_info() - Request statistics about a database
• ibase_drop_db() - Drops a database
• ibase_errcode() - Return an error code
• ibase_free_event_handler() - Cancels a registered event handler
• ibase_gen_id() - Increments the named generator and returns its new value
• ibase_maintain_db() - Execute a maintenance command on the database server
• ibase_name_result() - Assigns a name to a result set
• ibase_num_params() - Return the number of parameters in a prepared query
• ibase_param_info() - Return information about a parameter in a prepared query
• ibase_restore() - Initiates a restore task in the service manager and returns

Differences Between PHP 4 and 5:-

What's New in PHP 5?



The long anticipated PHP 5 release comes with a slew of new features aimed at simplifying development with PHP. With PHP 5 comes the introduction of exception handling, the Standard PHP Library (SPL), enhanced support for XML, reflection, and quite a few enhancements to the object oriented features of the language. PHP 5 also offers a sizable list of new functions

if you're interested in pursuing XML, SOAP, web services and the like, you'll really be much better off with PHP 5...

php interview questions

# File Download appears for .php files. Php.ini in \windows on XP.

# How can I pass objects from one php file to another?

# How to create a web page that refreshes its tabled contents against mySQL database?

# function_exists doesn't appear to work on class member functions, regardless if static or not???

# can you determine whether your script is running at the console or was requested remotely?

# I want printing on continous paper according to my requirement. Wanted to control the printer

# Sessions won't die. I tried evertything. I'm regitering using the $_SESSION superglobal. Please h

# how to resubmit the information automatically without pressing the refresh button?

# How to check if a newer entry is in mysql db? If yes, use 1 field in latest record as a variable.

# Is there a function like file_exists in PHP Version 2 ?

# how com i can not add item to httpd.conf to make php work with apache on windows?

# How does one define the path to non-windows executables like cat.exe?

# How does one define the path to non-windows executables like cat.exe?

# Help! What do I do Php files opening as Ps files?

# need to use [web] as a wildcard: elseif ($check == "go: [web]") {$url = "[web]";} is it possible?

# What is the advantage to using "url/index.php?i69=members" over "url/index.php" to "url/members.php"

# Why don't works including of remote files under IIS 5.1 and PHP 4.3.2?

# How can I parse a .csv file to a .ldf file , only parsing the particular information that I need?

# where do i outsource php or get php experts for development ?

# Can anyone please tell me why .php files will work for me but the same php files in HTML do not work

# Populating a dropdown list field with data fetched from Oracle

# How do I display New mysql database info without refreshing the page?

# is there a course on how to write force matrix in php scripts?

# SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specifi

# i am getting msg"Can not open output stream {localhost:110/pop3}INBOX when i am calling imap_open()

# I CAN'T RUN PHP AS MODULE IN APACHE ON WINDOWS XP (PHP-4.3.6 AND APACHE-2.0.49)

# how do i get information from a plain text file as data for a marqee/ticker/scroller?

# How can I set up my web browser to show Php designated sites?

# How i can find number of record retuned in select statement usin Access odbc driver.

# When i try to exec a program on a webserver i get 127 as an return value. What does it mean?

# PHP4 will not connect to my Apache server. I'm using an IBserver program.

# form subbmitted to csv, how do you remove file if form submitted and file already exists

# form subbmitted to csv, how do you remove file if form submitted and file already exists

# Is there a known issue with O'Reilly Website and PHP not working together?

# is it possible to capture a swf and export it to jpg?

# How can I insert dynamic info in my website (eg. exchange rate) taken from other site? Any scripts?

# How do i connect php5 to mysql4? I get "Class 'mysqli' not found" in the apache error log?

# I tried to call mysql_connect(), but got the error "Call to undefined function mysql_connect() Idea?

# How do I include a "news.php" file into an index.php file, I've tried
# How to support PHP? no IIS,no apache,it is my develope server...it support CGI now.

# How to support PHP? no IIS,no apache,it is my develope server...it support CGI now.

# How can I adjust local date time in a PHP Calendar script?

# How can I call or use a dll writen in Visual Basic 6.0

# how to redirect a page, and how to use querystring

# when i open file by using this command ($fp=fopen("hello.txt","w") i get message "permission denied"

# i am using Windows 2000 Server with PHP 4 and Apache 2 , i am trying use scrrun.dll with PHP but fail to use any body suggest me how to use it?

# Are php scripts secure? i.e. is it possible to open my .php file and get my db userid/password etc?

# Why am I getting a blank screen when I try using the imagecreatefromjpeg function? (PHP 5.0.2)

# Problem logging hits to PHP pages when PHP runs as CGI wrapped in Apache to appear as module.

# Is it possible to make a template in which any called text file can be inserted into a specific area

# I need to get my php date() time to update live, is there away, and how do I do it?

# How would I make a template system for a blog?????

# Error "server unwilling to perform" when changing password in an AD server using LDAP and PHP.

# How can I read data in from a USB Barcode Scanner using PHP???

# How can I read data in from a USB Barcode Scanner using PHP???

# How can I update the options for a select menu based on a value selected in a previous select menu?

# php.exe posting data vir commandline how to?

# How can I code a simple form with textboxes so users can view what others posted?

# why my scripts is showing warning mail over quota mail not send when new user register

# how can I make something like php editor in php and the script is in colored

# I'm having a problem compiling php with 2 versions of posgresql. Configuring with-pgsql=/usr (pg ver

# How do I automatically display the number of listings next to category links using mySQL or no datab

# PHP 4.3.4, parse_ini_file() returns a cannot open `FILE` for reading?

# how can I set a quantity that reduces to zero in my eshop as orders are placed

# Is it possible to copy a tar file from another server using fopen?

# Iwant to make register (login and password) to my site but with php

# how to use onchange method of listboxes in php?

# Can I make a transparent HTTP(carry SOAP body) proxy with PHP? Here PHP is to determine the dest.

# how can i use PHP mail() function to send mail to an address like info@academia-intl.com...?

# How do I test that a remoter server has php working?

# is there a way to import php in a mysql and export it?

# Trouble allowing people to upload picture to yahoo hosted site

# Best script to pull an series of integers from various offsets in a binary file to PHP variables?

# Problem with php 5.0.3 on Apace 2 on WIN: It works but version sais: 4.3.10? Is it really 5.0.3 in..

# I'm getting a pair of characters( 3D ) in my PHP Generated E-Mails, any suggestions?

# Can someone tell me why my

How can I use PGP with PHP?

How do I format a number correctly?

How do i upload files from php to my ISP / server?

I keep getting "headers already sent" whilst trying to use sessions

How do I user authentication in php?

How do I set the browser timeout?

How can I create random passwords?

Is there a way to encrypt text from php?

How can I limit search results so that there is a "Next 10" and "Previous 10"?

How can I protect pages using MySQL and PHP?

How do I check whether a string contains HTML?

How to count number of parameters given in URL by POST?

Is it possible to spell check texts from php?

Does anyone know some URLS for good tutorials on PHP?

How do I get the total size of a certain directory?

How to output a number with leading zero's?

How do I find out weather a number is odd or even?

How can I do error handling in php?

How do I work with dates in php?

How can I get the DNS servers of a domain name?

What's the difference between the *connect and *pconnect database functions?

Is it possible to validate an e-mail in php?

Is it possible to connect to a ftp server with php?

How can I mail the content of a form?

I keep getting "Data Missing" when I click the "back" button in my browser. How can I stop this?

Using Curl can I access the OpenSRS admin control panel (tucows)

How to access a COM object from within my PHP page?

How do I make links on mail and www links on my pages?

I have an array of values and want to show them all reccursivly how?

How do I find out if an array has values posted to each of its elements? I need to know that EVERY element has been filled out.

Use ereg_replace to replace only the first occurence of a string instead of all?

How do you colour code the source in the answers on alt-php-faq.org?

I have upgraded to PHP-4.0.5, since doing that some of my scripts are just showing the source code?

Php and appache Questions

How to install PHP on Apache?
How do I install Apache, MySQL, PHP on Linux?
I am trying to install GD + Truetype with PHP4, but all I get is libgd was not built with TrueType font support
How did you install PHP with --mcrypt and --mhash?
When using GD/PHP to create thumbnails using imagecopyresized the thumbnail quality is not very good.
Can I compile php with mysql without having mysql sources?
How do I install PHP as a CGI?
How can I get PWS (Microsoft Personal Webserver) to work?
I have errors trying to install libxml so I can use --with-dom for PHP (checking for DOM in default path... not found)?
How do I install Sablotron with PHP?
How do I stop spammers using header injection with my PHP Scripts? (Webmasters)
Is there a Windows version of MySQL?
Is there an archive that installs mysql,php4,apache and perl on a windows system?
I'm trying to compile PHP 4.1.1 on a SunOS 5.8 box as a DSO module with mcrypt 2.4.18 (i.e. libmcrypt.so.4.2.8), I get loads of errors.
What do I have to do to convert PHP3 pages to PHP4 pages? Are there any compatibility problems?
How do I install Sablotron to work with PHP on Windows?
What version should I install?
How do I install the PostGRESQL client librarys so PHP can talk to remote PGSQL servers?
make install gives an error saying i need LoadModule line in httpd.conf but its already there
Use ereg_replace to replace only the first occurence of a string instead of all?
Installing MySQL Perl Modules DBI
error: conflicting types for `XML_FEATURE_UNICODE'
How do I stop spammers using header injection with my PHP Scripts? (Server Admin)
How do I install Curl?
Installing ioncobe with php5.2.3 gives the error Failed loading ioncube_loader_lin_5.2.so: ioncube_loader_lin_5.2.so: undefined symbol: zend_hash_destroy

6. How can we extract string ‘abc.com ‘ from a string ‘http://info@abc.com’ using regular expression of PHP?

A: i. using strstr function
Echo strstr(“http://info@abc.com”, ‘@’)
or
ii. using list and split functions
list($first,$second)=split(“@”,”http://info@abc.com”,2)
echo $second;

4. What is the difference between mysql_fetch_object and mysql_fetch_array?

A: mysql_fetch_array
i. We can access the data by the field names or their offsets
mysql_fetch_object
i. We can only access the data by the field names

3. In how many ways we can retrieve the data in the result set of mysql using PHP?

A: In four ways we can retrieve data from mysql database. They are
i. mysql_fetch_array();
ii. mysql_fetch_row();
iii. mysql_fetch_assoc()
iv. mysql_fetch_object()

2. How can we submit a form without a submit button?

A: We can submit a form in many ways without a submit button. The are,
i. When user select combo box.
ii. When user click on check box.
iii. When user click on radio button.
iv. Using href statements onClick="location.href='sample.php”

1. What are the differences between Get and post methods in form submitting, give the case where we can use get and we can use post methods?

A: Get:
i. Get is one of the predefined variables.
ii. It is used to send short data
iii. Get data variables and values are visible at browser.
iv. It is unsecure.
v. 2083 character we can pass through url
Post:
i. Post is one of the predefined variables.
ii. It is used to send more than 100 characters
iii. Post data variables and values are not visible at browser.
iv. It is secure.
v. 8 mb of data we can post