I’m trying to echo a user name and a greeting from IF statement i made.
<?php
global $current_user;
get_currentuserinfo();
echo get_avatar( $current_user->ID, 64 );
$hour = date('G');
if ($hour < 12) {
$greeting = 'Good Morning';
} else if ($hour < 18) {
$greeting = 'Good Evening';
} else {
$greeting = 'Good Night';
}
echo '<div class="greeting">'.($greeting). , .$current_user->user_login. '</div>';
?>
but i’m getting syntax error:
syntax error, unexpected ‘,’
How can i echo 2 variables into one div?
Your comma should be enclosed in a string: