Use preg_match as suggested by Josh:
<?php
$foo = 'Bob Williams';
$bar="SamSpade";
$baz = "Bob\t\t\tWilliams";
var_dump(preg_match('/\s/',$foo));
var_dump(preg_match('/\s/',$bar));
var_dump(preg_match('/\s/',$baz));
Ouputs:
int(1)
int(0)
int(1)
More Related Contents:
- Remove multiple whitespaces
- Replace tabs and spaces with a single space as well as carriage returns and newlines with a single newline
- PHP – Replace part of a string [closed]
- Get PHP to stop replacing ‘.’ characters in $_GET or $_POST arrays?
- remove script tag from HTML content
- Capturing text between square brackets in PHP
- get everything between and with php [duplicate]
- How do I remove all specific characters at the end of a string in PHP?
- Variable-length lookbehind-assertion alternatives for regular expressions
- How exactly do Regular Expression word boundaries work in PHP?
- How can I use .htaccess to hide .php URL extensions?
- PHP – regex to allow letters and numbers only
- preg_match() Unknown modifier ‘[‘ help
- Can someone explain the /e regex modifier? [duplicate]
- How do I replace double quotes with single quotes
- How to “Validate” Human Names in CakePHP?
- In PHP, how do I extract multiple e-mail addresses from a block of text and put them into an array?
- How to remove diacritics from text?
- PHP regular expression to match lines starting with a special character
- Using regex to filter attributes in xpath with php
- Get last whole number in a string
- RegExp in preg_match function returning browser error
- Regex for password PHP [duplicate]
- regular expression and forward slash
- Test if a string is regex
- Request exceeded the limit of 10 internal redirects
- Trim leading white space with PHP?
- How do I replace characters not in range [0x5E10, 0x7F35] with ‘*’ in PHP?
- PHP regex templating – find all occurrences of {{var}}
- Regex ignore URL already in HTML tags