Answer the question
In order to leave comments, you need to log in
Where did I make a mistake in php (writing to a variable, displaying it on the screen)?
I study php, I do elementary things. The problem is that if a variable in Notepad ++ is written by hand, then it is not read / does not work. It is difficult to explain in words, I made a special video. youtube.be/QjZoR9D702U
$hour = strftime( '%H' );
$welcome = '';
if ($hour > 0 and $hour < 6){
$welcomе = 'Доброй ночи';}
elseif ($hour >= 6 and $hour < 12){
$welcomе = 'Доброе утро';}
elseif ($hour >= 12 and $hour < 18){
$welcomе= 'Добрый день';}
elseif ($hour >= 18 and $hour < 23){
$welcomе = 'Добрый вечер';}
else
$welcomе = 'Доброй ночи';
<h1>echo $welcomе , Гость </h1>
Answer the question
In order to leave comments, you need to log in
The "e" in $welcome is Russian. Even the syntax highlighting says it all :-)
Even code highlighting on a toaster is smarter than your editor.
Install a decent IDE like PHPStorm. He will immediately identify such errors.
I posted a question and noticed that the "e" variable was added. It was me, through inattention, that I didn’t write “e” the first time and then added it. Maybe it somehow influenced? But the general code was identical.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question