$first = date('Y-m-d', mktime(0, 0, 0, $month, 1, $year));
$last = date('Y-m-t', mktime(0, 0, 0, $month, 1, $year));
See date() in PHP documentation.
Related Contents:
- Difference between require, include, require_once and include_once?
- How can I output a UTF-8 CSV in PHP that Excel will read properly?
- Two arrays in foreach loop
- Bind multiple parameters into mysqli query
- Convert SVG image to PNG with PHP
- PHP code to convert a MySQL query to CSV [closed]
- PHP calculate age
- PHP Sort Array By SubArray Value
- Upload Progress Bar in PHP
- Get the Last Inserted Id Using Laravel Eloquent
- Running MySQL *.sql files in PHP
- How to benchmark efficiency of PHP script
- List all files in one directory PHP [duplicate]
- Simple example to post to a Facebook fan page via PHP?
- Does file_get_contents() have a timeout setting?
- “Unknown modifier ‘g’ in…” when using preg_match in PHP?
- How can I run a PHP script inside a HTML file?
- PHP sessions timing out too quickly
- Read a plain text file with php
- How to extract a node attribute from XML using PHP’s DOM Parser
- Day difference without weekends
- PHP expects T_PAAMAYIM_NEKUDOTAYIM?
- best practice to generate random token for forgot password
- What does yield mean in PHP?
- How to convert string to boolean php
- PDO PHP Fetch Class
- Simplest way to increment a date in PHP?
- How to sort a multidimensional array by a certain key?
- PHP substring extraction. Get the string before the first ‘/’ or the whole string
- Get latitude and longitude automatically using php, API
- PHP – Secure member-only pages with a login system
- Hide shipping methods for specific shipping class in WooCommerce
- How to rename sub-array keys in PHP?
- Return from include file
- “Warning: Cannot modify header information – headers already sent by” error [duplicate]
- PHP Mail, CC Field
- PHP Warning Permission denied (13) on session_start() [duplicate]
- Posting JSON objects to Symfony 2
- How to call codeigniter controller function from view
- What are fragment URLs and why to use them?
- implicit class variable declaration in php?
- Detect mysql update/insertion failure due to violated unique constraint
- Can’t decrypt using pgcrypto from AES-256-CBC but AES-128-CBC is OK
- Can I use string concatenation to define a class CONST in PHP?
- Laravel 5.4 – Validation with Regex [duplicate]
- Downloading attachments to directory with IMAP in PHP, randomly works
- php/symfony/doctrine memory leak?
- How to obtain a nested HTML list from object’s array recordset?
- Is there any difference between __DIR__ and dirname(__FILE__) in PHP?
- Yii2 : ActiveQuery Example and what is the reason to generate ActiveQuery class separately in Gii?