<script type=”text/javascript”>
var string=”PHPCode”;
string=string.replace(“Code”,”Codez”);
alert(string);
</script>
Tag Archives: Functions
CURTIME() Vs NOW()
CURTIME() returns the TIME part of the current time.
NOW() returns the date and time portions as a timestamp in various formats, depending on how it was requested
Example
mysql> SELECT NOW(),CURDATE(),CURTIME();
+———————+————+———–+
| NOW() | CURDATE() | CURTIME() |
+———————+————+———–+
| 2012-06-18 14:14:01 | 2012-06-18 | 14:14:01 |
+———————+————+———–+
1 row in set (0.03 sec)
The difference between MySQL CURTIME() and NOW()
CURTIME() returns the TIME part of the current time.
NOW() returns the date and time portions as a timestamp in various formats, depending on how it was requested
Example
mysql> SELECT NOW(),CURDATE(),CURTIME();
+———————+————+———–+
| NOW() | CURDATE() | CURTIME() |
+———————+————+———–+
| 2012-06-18 14:14:01 | 2012-06-18 | 14:14:01 |
+———————+————+———–+
1 row in set (0.03 sec)
MySQL CURDATE() Vs NOW()
CURDATE() returns the DATE part of the current time.
NOW() returns the date and time portions as a timestamp in various formats, depending on how it was requested
Example
mysql> SELECT NOW(),CURDATE(),CURTIME();
+———————+————+———–+
| NOW() | CURDATE() | CURTIME() |
+———————+————+———–+
| 2012-06-18 14:14:01 | 2012-06-18 | 14:14:01 |
+———————+————+———–+
1 row in set (0.03 sec)
The difference between MySQL CURDATE() and NOW()
CURDATE() returns the DATE part of the current time.
NOW() returns the date and time portions as a timestamp in various formats, depending on how it was requested
Example
mysql> SELECT NOW(),CURDATE(),CURTIME();
+———————+————+———–+
| NOW() | CURDATE() | CURTIME() |
+———————+————+———–+
| 2012-06-18 14:14:01 | 2012-06-18 | 14:14:01 |
+———————+————+———–+
1 row in set (0.03 sec)
Language Constructs
Language constructs are used and behave almost similar to built-in functions .
The real difference lies in how PHP engine interprets a language construct and a built-in function. language constructs are relatively faster over built-in functions since they are bound to the language.Language Constructs Don’t Need Parenthesis .Language constructs are faster than built in functions
Below given are the examples
echo
die
if
print
unset
isset
empty
include
require
Can echo in php accept more than 1 parameter?
Yes echo() can accept more than one arguments .
mysql_connect() vs mysql_pconnect()
Difference between mysql_connect() and mysql_pconnect() PHP
mysql_pconnect() acts very much like mysql_connect() with two major differences.
When connecting using mysql_pconnect() , the function would first try to find a (persistent) link that’s already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection.
When connecting using mysql_connect(), the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use
Note :mysql_close() will not close links established by mysql_pconnect().
Difference between mysql_connect() and mysql_pconnect() PHP
Difference between mysql_connect() and mysql_pconnect() PHP
mysql_pconnect() acts very much like mysql_connect() with two major differences.
When connecting using mysql_pconnect() , the function would first try to find a (persistent) link that’s already open with the same host, username and password. If one is found, an identifier for it will be returned instead of opening a new connection.
When connecting using mysql_connect(), the connection to the SQL server will not be closed when the execution of the script ends. Instead, the link will remain open for future use
Note :mysql_close() will not close links established by mysql_pconnect().
Include() Vs Include_once()
Both functions includes the given file but Include_once() checks whether the given file is already included .As the name suggests , the file will be included only once .