PHP date() function formats a local date and time, and returns the formatted date string. In this article, I described the simple process about how to add and subtract number of days from current date using default PHP date() function. Add number of days in current date: php strtotime add…
PHP date() function formats a local date and time, and returns the formatted date string. In this article, I described the simple process about how to add and subtract number of years from the current date using default PHP date() function. Add number of years in current date: (Example: adding 5 years)…
PHP date() function formats a local date and time, and returns the formatted date string. In this article, I described the simple process about how to add and subtract number of weeks from current date using default PHP date() function. Add number of weeks in current date: (Example: adding 5 weeks) <?php…
PHP date() function formats a local date & time, it returns the formatted string formatted date. In this article, I described the simple process about how to add and subtract number of months from the current date using default PHP date() function. Add number of months in current date: (Example:…
The 'strtotime()' function parses an English textual datetime into a Unix timestamp and it is quite powerful with relative time format. Example: ### To get sunday timestamp of current week strtotime('sunday this week'); ### To get monday timestamp of current week strtotime('monday this week');
Use Date::Parse to convert normal date string to epoch timestamp. Date::Parse provides two routines for parsing date strings into time values. str2time(DATE [, ZONE]) str2time parses DATE and returns a unix time value, or undef upon failure. ZONE, if given, specifies the timezone to assume when parsing if the date…
Generating random strings with custom specified length is most required functionality in every project. In this article, I described the easiest way to generate custom length random string. PHP program for Random String Generate: <?php /* * Function to generate random string * Default length 30 character */ function generateRandomString($length…
stdClass is the default PHP object. stdClass has no properties, methods or parent. It does not support magic methods, and implements no interfaces. Standard way to create an "empty" object is: <?php $input_object = new stdClass(); var_dump($input_object); ?> Result for new stdClass(): object(stdClass)#1 (0) { } But, with PHP Version…
The end() function is an inbuilt function in PHP Programming. The purpose of this function is to find the last element of the given input array. The end() function changes the internal pointer of an array to the last element and returns the value of the last element. end() PHP…
I will guide you to copy all files & sub directories of the directory to another directory using PHP copy() function. There are many other functions used to copy the content of one directory to another. copy() Functionopendir() Functionis_dir() Functionscandir( ) Functionreaddir() Function PHP code for copy multiple files from…