Find Difference between two dates in PHP
Convert both dates to epoch timestamps and subtract one from the other. Use this code to separate the difference into weeks, days, hours, minutes, and seconds:
Read tutorialTHE TUTORIAL LIBRARY
Convert both dates to epoch timestamps and subtract one from the other. Use this code to separate the difference into weeks, days, hours, minutes, and seconds:
Read tutorialYou have data in comma-separated values (CSV) format, for example a file exported from Excel or a database, and you want to extract the records and fields into a format you can man
Read tutorialMerging arrays with only numerical keys causes the arrays to get renumbered, so values aren't lost. Merging arrays with string keys causes the second array to overwrite the value o
Read tutorialOnce processing is completed, array_unique()is the best way to eliminate duplicates. But, if you're inside a loop, you can eliminate the duplicate entries from appearing by checkin
Read tutorialThe sort() function doesn't preserve the key/value association between elements; instead, entries are reindexed starting at 0 and going upward. (The one exception to this rule is a
Read tutorialWith foreach, PHP iterates over a copy of the array instead of the actual array. In contrast, when using each() and for, PHP iterates over the original array. So, if you modify the
Read tutorialWhen a browser sees a 401 header, it pops up a dialog box for a username and password. Those authentication credentials (the username and password), if accepted by the server, are
Read tutorialIt's a good idea to make the expiration time a few hours or an entire day in the past, in case your server and the user's computer have unsynchronized clocks. For example, if your
Read tutorialA cookie's value isn't available in $_COOKIE during the request in which the cookie is set. In other words, the setcookie() function doesn't alter the value of $_COOKIE. On subsequ
Read tutorialYou can pass additional arguments to setcookie() to control cookie behavior. The third argument to setcookie() is an expiration time, expressed as an epoch timestamp. For example,
Read tutorialThe mcrypt extension is an interface with mcrypt, a library that implements many different encryption algorithms. The data is encrypted and decrypted by mcrypt_encrypt()and mcrypt_
Read tutorialPHP can support a few different kinds of DBM backends: GDBM, NDBM, DB2, DB3, DBM, and CDB. The DBA abstraction layer lets you use the same functions on any DBM backend. All these b
Read tutorialOne example today. A better developer tomorrow.