This is a discussion on PHP/MySql - A view in the point of Interview within the PHP Programming forums, part of the Web Development category; How can we know the number of days between two given dates using PHP? Simple arithmetic: $date1 = date('Y-m-...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| How can we know the number of days between two given dates using PHP? Simple arithmetic: $date1 = date('Y-m-d'); $date2 = '2006-07-01'; $days = (strtotime() - strtotime()) / (60 * 60 * 24); echo "Number of days since '2006-07-01': $days";
__________________ Thanks & Regards, Jegan CBK "We will either find a way, or make one! |
| Sponsored Links |
| |||
| What are the differences between require and include, include_once? Anwser 1: require_once() and include_once() are both the functions to include and evaluate the specified file only once. If the specified file is included previous to the present call occurrence, it will not be done again. But require() and include() will do it as many times they are asked to do. Anwser 2: The include_once() statement includes and evaluates the specified file during the execution of the script. This is a behavior similar to the include() statement, with the only difference being that if the code from a file has already been included, it will not be included again. The major difference between include() and require() is that in failure include() produces a warning message whereas require() produces a fatal errors. Anwser 3: All three are used to an include file into the current page. If the file is not present, require(), calls a fatal error, while in include() does not. The include_once() statement includes and evaluates the specified file during the execution of the script. This is a behavior similar to the include() statement, with the only difference being that if the code from a file has already been included, it will not be included again. It des not call a fatal error if file not exists. require_once() does the same as include_once(), but it calls a fatal error if file not exists. Anwser 4: File will not be included more than once. If we want to include a file once only and further calling of the file will be ignored then we have to use the PHP function include_once(). This will prevent problems with function redefinitions, variable value reassignments, etc.
__________________ Thanks & Regards, Jegan CBK "We will either find a way, or make one! |
| |||
| Explain the ternary conditional operator in PHP? Expression preceding the ? is evaluated, if it’s true, then the expression preceding the : is executed, otherwise, the expression following : is executed
__________________ Thanks & Regards, Jegan CBK "We will either find a way, or make one! |
| |||
| What is the difference between Reply-to and Return-path in the headers of a mail function? Reply-to: Reply-to is where to delivery the reply of the mail. Return-path: Return path is when there is a mail delivery failure occurs then where to delivery the failure notification.
__________________ Thanks & Regards, Jegan CBK "We will either find a way, or make one! |
| |||
| What Is a Persistent Cookie? A persistent cookie is a cookie which is stored in a cookie file permanently on the browser's computer. By default, cookies are created as temporary cookies which stored only in the browser's memory. When the browser is closed, temporary cookies will be erased. You should decide when to use temporary cookies and when to use persistent cookies based on their differences: *Temporary cookies can not be used for tracking long-term information. *Persistent cookies can be used for tracking long-term information. *Temporary cookies are safer because no programs other than the browser can access them. *Persistent cookies are less secure because users can open cookie files see the cookie values.
__________________ Thanks & Regards, Jegan CBK "We will either find a way, or make one! |
| |||
| Quote:
Sometimes it is useful to refer to functions and variables in base classes or to refer to functions in classes that have not yet any instances. The :: operator is being used for this. Code: <?php
class A {
function example() {
echo "I am the original function A::example().<br />\n";
}
}
class B extends A {
function example() {
echo "I am the redefined function B::example().<br />\n";
A::example();
}
}
// there is no object of class A.
// this will print
// I am the original function A::example().<br />
A::example();
// create an object of class B.
$b = new B;
// this will print
// I am the redefined function B::example().<br />
// I am the original function A::example().<br />
$b->example();
?> There are class functions, but there are no class variables. In fact, there is no object at all at the time of the call. Thus, a class function may not use any object variables (but it can use local and global variables), and it may not use $this at all. In the above example, class B redefines the function example(). The original definition in class A is shadowed and no longer available, unless you are referring specifically to the implementation of example() in class A using the ::-operator. Write A::example() to do this (in fact, you should be writing parent::example(), as shown in the next section). In this context, there is a current object and it may have object variables. Thus, when used from WITHIN an object function, you may use $this and object variables. Regards, R.Kamalakannan. |
| |||
| What is the difference between mysql_fetch_object and mysql_fetch_array? MySQL fetch object will collect first single matching record where mysql_fetch_array will collect all matching records from the table in an array
__________________ Thanks & Regards, Jegan CBK "We will either find a way, or make one! |
| |||
| How can I execute a PHP script using command line? Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line argument. For example, "php myScript.php", assuming "php" is the command to invoke the CLI program. Be aware that if your PHP script was written for the Web CGI interface, it may not execute properly in command line environment.
__________________ Thanks & Regards, Jegan CBK "We will either find a way, or make one! |
| |||
| What is the functionality of the functions STRSTR() and STRISTR()? string strstr ( string haystack, string needle ) returns part of haystack string from the first occurrence of needle to the end of haystack. This function is case-sensitive. stristr() is idential to strstr() except that it is case insensitive
__________________ Thanks & Regards, Jegan CBK "We will either find a way, or make one! |
| |||
| What is the difference between ereg_replace() and eregi_replace()? eregi_replace() function is identical to ereg_replace() except that it ignores case distinction when matching alphabetic characters
__________________ Thanks & Regards, Jegan CBK "We will either find a way, or make one! |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What is a rendezvous point? | Shanthi | Testing Tools | 2 | 11-16-2007 04:41 AM |
| MYSQL - Interview Questions | Murali | Interview Questions & Answers and Tips | 8 | 09-04-2007 08:42 AM |
| MYSQL interview questions | it.wily | Interview Questions & Answers and Tips | 1 | 09-04-2007 04:33 AM |
| what is page check point in QTP? | sundarraja | Testing Tools | 1 | 08-13-2007 04:35 AM |
| Function point | prasath | Software Testing | 1 | 07-17-2007 07:49 AM |