$test = sprintf(\"SELECT * FROM `table` WHERE `text` LIKE \'%%s%\'\", mysql_real_escape_string(\'test\')); echo $test;
output:
SELECT
$test = "SELECT * FROM `table` WHERE `text` LIKE '%s%'" . mysql_real_escape_string('test'); echo $test;