0

Simple and newbie question about spacing, how to make spacing before $tag ?

$key[rand(0, count($ey)-1)] . $tag

Thanks for your help.

Simeon Visser
  • 118,920
  • 18
  • 185
  • 180
alyasabrina
  • 2,977
  • 3
  • 16
  • 7

2 Answers2

2

You can simply add a space and concatenate the rest:

$key[rand(0, count($ey)-1)] . ' ' . $tag
Simeon Visser
  • 118,920
  • 18
  • 185
  • 180
1

You can add the space and concatenate the tag. Like said in the previous answer.

$key[rand(0, count($ey) - 1)] . ' ' . $tag;

You can also use double quotes like this. In $x will be stored the same value as in the example before. This is useful when you want to add many variables together.

$myKeyValue = $key[rand(0, count($ey) - 1)];
$x = "$myKeyValue $tag";

And the space there is not trimmed, so you can make the space longer if you want.

$key[rand(0, count($ey) - 1)] . '     ' . $tag;
Martin54
  • 1,349
  • 2
  • 13
  • 34