-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
  • 184
  • 1
  • 14
acoder
  • 739
  • 5
  • 19

1 Answers1

1

You need to use the substr() function

echo substr($msg, 0, 10);
mega6382
  • 9,211
  • 17
  • 48
  • 69
SamHecquet
  • 1,818
  • 4
  • 19
  • 26