Answers for "how to check if string contains space php"

PHP
0

if name value contains space in php

if ($str == trim($str) && strpos($str, ' ') !== false) {
    echo 'has spaces, but not at beginning or end';
}
Posted by: Guest on March-07-2021
0

check if string contains only whitespace php

ctype_space("  ") //returns true

ctype_space("   a   ") //returns false
Posted by: Guest on July-03-2020

Code answers related to "how to check if string contains space php"

Browse Popular Code Answers by Language