Answers for "if string contain spaces 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

Browse Popular Code Answers by Language