check if string contains only whitespace php

PHP
ctype_space("  ") //returns true

ctype_space("   a   ") //returns false
Source

Also in PHP: