Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

codingwithcats
codingwithcats
3,564 Points

var_dump($day); returning PHP Warning: date() expects at least 1 parameter, 0 given

Hi all,

This seems like a super silly step to get stuck on, but I can't work out where I've gone wrong.

https://w.trhou.se/k074ac3b6t

When I try running var_dump($day) I get the following message in my console:

PHP Warning: date() expects at least 1 parameter, 0 given in /home/treehouse/workspace/exercise.php on line 15

I've tried the following with no luck: *including date_default_timezone_set() function *changing 'N' to 'D'

Can anyone help?

Dave StSomeWhere
Dave StSomeWhere
19,870 Points

Are you trying that from your exercise.php?

Your code is invalid:

<?php
$day = date();  // this is missing the format parameter
// try something below 
$day = date("l");
var_dump($day);
// output
string(6) "Friday"

1 Answer

codingwithcats
codingwithcats
3,564 Points

Hi Dave,

Thanks for taking the time to reply. The screenshot showed up differently than the version of the workspace I was looking at - date () vs date('N') - when I closed and re-opened it worked just fine. Think it may have been something as simple as forgetting to save! facepalm

Kind regards, Clarissa