PHP
How do I find out the number of parameters passed into function9. ?
Dec 13th
func_num_args() function returns the number of parameters passed in.
How can we register the variables into a session?
Dec 13th
We can use the session_register ($ur_session_var) function.
What is the difference between htmlentities() and htmlspecialchars()?
Dec 9th
htmlspecialchars() – Convert some special characters to HTML entities (Only the most widely used) htmlentities() – Convert ALL special characters to HTML entities
Will comparison of string “10″ and integer 11 work in PHP?
Dec 9th
Yes, internally PHP will cast everything to the integer type, so numbers 10 and 11 will be compared.
How can we know the number of days between two given dates using MySQL?
Dec 9th
Use DATEDIFF()
SELECT DATEDIFF(NOW(),’2006-07-01′);
How can we change the name of a column of a table?
Dec 9th
MySQL query to rename table: RENAME TABLE tbl_name TO new_tbl_name
[, tbl_name2 TO new_tbl_name2] …
What are the differences between PROCEDURE ORIENTED LANGUAGES AND OBJECT ORIENTED LANGUAGES?
Dec 9th
Traditional programming has the following characteristics:
Functions are written sequentially, so that a change in programming can affect any code that follows it.
If a function is used multiple times in a system (i.e., a piece of code that manages the date), it is often simply cut and pasted into each program (i.e., a change log, order function, fulfillment system, etc). If a date change is needed (i.e., Y2K when the code needed to be changed to handle four numerical digits instead of two), all these pieces of code must be found, modified, and tested.
Code (sequences of computer instructions) and data (information More >
How can I find what type of images that the php version supports? `
Dec 9th
Using Imagetypes() function we can know Usage:
<?php
if (imagetypes() & IMG_PNG) {
echo “PNG Support is enabled”; }
?>
How can I get the only name of the current executing file?
Dec 8th
<?php
$curfilename = __FILE__; //current file name with full path $pieces = explode(“\\”, $curfilename);
$onlyfilenamewithext = $pieces[count($pieces)-1]; //current file name with extension only
$temp = explode(“.”,$onlyfilenamewithext);
$onlyfilename = $temp[0]; //current file name without extension echo $onlyfilename;
?>
What is the difference between using copy() and move() function in php file uploading?
Dec 8th
copy ( string source, string dest)
Makes a copy of the file source to dest. Returns TRUE on success or FALSE on failure.
Usage:
<?php
if (!copy($file, $file.’.bak’)) {
echo “failed to copy $file…<br />\n”; }
?>
move_uploaded_file ( string filename, string destination)
This function checks to ensure that the file designated by filename is a valid upload file (meaning that it was uploaded via PHP’s HTTP POST upload mechanism). If the file is valid, it will be moved to the filename given by destination.
If filename is not a valid upload file, then no action will occur, and move_uploaded_file() will return FALSE.
If filename is a valid upload file, More >
