Returning the number of spaces in a String

Asked

Viewed 53 times

0

Not only spaces, but any other letter, for example.

Is there any function that will return this to me?

I’ve tried to :

public function verifica_nome()
{
    return substr_count($this->name, " ");
}

But the same always returns 0...

  • 5

    Have the $this->name before running to see if she has the text she thinks she is. Your real problem should be this.

1 answer

2


  • I was using this function. But it always returned 0.

  • Look here: http://www.w3schools.com/php/showphp.asp?filename=demo_func_string_substr_count

Browser other questions tagged

You are not signed in. Login or sign up in order to post.