我正在构建一个拼写检查程序,我正在使用foreach变量从长字符串中获取一个单词。我希望如果文本用引号括起来,它应该回显引号,回显该单词,然后在结尾处回显另一个引号...
请帮助......
提前致谢。
答案 0 :(得分:1)
<?php
$word = '"TheWordSurroundedWithQuotationMark"';//This is the foreach variable,i initialised this with random thing
if(2==substr_count($word, '"'))//checking if the string is wrapped with quotation marks
{
$items = explode('"',$word);
echo 'The string is surronded with Quotation marks ==> '.$items[1];
}
?>