「PHP」エラーWarning: Use of undefined constant xxx – assumed ‘xxx’ の対応方法

現象
Warning: Use of undefined constant xxx – assumed 'xxx’ (this will throw an Error in a future version of PHP)
in xxxx.php on line 7

PHPコード
$cftA = “テストデータabcきたく";

if (preg_match(“/^[0-9]+$/", cftA)) {
echo “変数Aが半角数字です"."<br>\n"; ;
}
原因
変数cftAの$忘れ

修正後
if (preg_match(“/^[0-9]+$/", $cftA)) {

PHP

Posted by arkgame