The following will work similarly to your CF code:
<?= (substr_count($datafield, "keys") > 0) ? "checked" : ""; ?>
Basically it says that if "keys" appears in the string $datafield more than zero times, to print "checked", and otherwise print nothing ("").