Php string concatenation

now there is an ajax local refresh, which I want to write. Concatenate a string on the server and return it to the client, but it is illegal to write like this, how to write it better? I have tried. The ternary operator is fine, but it is not suitable for the current demand

echo "3333" . (if ($a==1) {
    $a
}else{$b});
Mar.23,2021

echo '3333'. ( ($a==1) ? $a : $b );

or:

echo '3333' . (function($a,$b){
   if ($a==1) {
    return $a
   }else{
    return $b
   }
}($a,$b));
Why does the

ternary operator not conform to the project? In fact, the ternary operator is very simple, otherwise you have to close or directly judge the result before splicing the output

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c620-2c312.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c620-2c312.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?