S
S
Sergey2015-03-07 12:05:34
PHP
Sergey, 2015-03-07 12:05:34

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><?php echo $welcomе ?>, Гость</h1>
I want to understand what the problem is and not to face similar things in the future. But I lost time, for 2 hours I was looking for what the problem was.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
P
Pr00f, 2015-03-07
@zeyser

Syntax highlighting hints that "e" is Russian.

V
Vladimir Martyanov, 2015-03-07
@vilgeforce

The "e" in $welcome is Russian. Even the syntax highlighting says it all :-)

O
OnYourLips, 2015-03-07
@OnYourLips

Even code highlighting on a toaster is smarter than your editor.
Install a decent IDE like PHPStorm. He will immediately identify such errors.

S
Sergey, 2015-03-07
@zeyser

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.

K
KorsaR-ZN, 2015-03-07
@KorsaR-ZN

As already mentioned above, there e is Russian, in order to avoid this, go to full-fledged IDEs, such as PHPStorm.
After a week of work, you will understand how convenient it is...
If you don't want an IDE, then use Sublime or Atom

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question