Php echo add spaces

How do I get spaces after the current username is displayed? It just needs a few spaces because it works in something else.

<?php if ( is_user_logged_in() ) { global $current_user; get_currentuserinfo(); echo '<span class="white-text">Welcome, &nbsp;' .$current_user->user_firstname . "</span>\n";} ?> 
+4
source share
5 answers

The best way would be to not add more spaces, but to add a marker:

 <span class="white-text" style="margin-right: 5em;"> 

Change 5em to another number to change the amount of space.

+2
source
 echo '<span class="white-text">Welcome, &nbsp;' .$current_user->user_firstname . " &nbsp; &nbsp;&nbsp;&nbsp; </span>\n"; 

everyone is an "inextricable space"

+2
source

Your code does not work, because extra spaces are ignored, this is normal. Only the first space character is returned, if you want more, use &nbsp; (inextricable space).

You can also margin text with CSS:

 span.white-text { margin: 5px; } 
+1
source

try it

 echo "<span class='white-text'>Welcome," . " " .$current_user->user_firstname."</span>\n"; 
0
source
 echo "<td>" . $info['id'] . "</td>"; echo "<td></td>"; echo "<td></td>"; echo "<td>" . $info['refid'] . "</td>"; echo "<td></td>"; echo "<td></td>"; echo "<td>" . $info['username'] . "</td>"; 
0
source

All Articles