PHP: Merge three variables (year, month, day) into one date : <p>I have three variables:</p>

<p>1.) $year (e.g. "2018"),</p>

<p>2.) $month (e.g. "9" or "12"),</p>

<p>3.) $day (e.g. "5" or "21").</p>

<p>I want to merge them into one single variable ($date) in the format of YYYY-mm-dd, i.e. "2018-09-14".</p>

<p>Note that the month "9" and the day "5" now have "0" in front of them.</p>

<p>What would be the best way to do so? </p>

<p>Thank you!</p>
