-6

I have a variable. I want to show 10 letter from there.

$msg = "Hello World! How are you.";

I want to show only Hello Worl this(first 10 letters).

Peps
  • 157
  • 1
  • 14
acoder
  • 699
  • 4
  • 19

1 Answers1

1

You need to use the substr() function

echo substr($msg, 0, 10);
mega6382
  • 8,889
  • 16
  • 47
  • 67
SamHecquet
  • 1,788
  • 4
  • 19
  • 26