PHP empty() function syntax: empty(“string”); PHP example of empty… The PHP function empty is often used to check if a particular variable is empty or not (duh). First, it checks to see if the variable exists. String myStr1 = "Jack Sparrow"; String myStr2 = ""; Here is a simple way to do a check that will work: