デフォルトのコードを実行する方法はありますか。これを説明する方法はわかりませんが、最善を尽くします。
<?php
if ($test == "CODE-*AnyWordHere*"){
echo "Yes";
}
?>
もう一つの例:
<?php
if ($url == "http://stackoverflow.com/secretplace/index.html/?*AnyWordHere*"){
echo "Yes";
}
?>
デフォルトのコードを実行する方法はありますか。これを説明する方法はわかりませんが、最善を尽くします。
<?php
if ($test == "CODE-*AnyWordHere*"){
echo "Yes";
}
?>
もう一つの例:
<?php
if ($url == "http://stackoverflow.com/secretplace/index.html/?*AnyWordHere*"){
echo "Yes";
}
?>
strpos()
または次を使用できます。
function strending($string, $keyword){
return substr($string, strlen($string)-strlen($keyword), strlen($string)) == $keyword;
}
strending("hello world", "world"); //true
strending("hello world!", "world"); //false
これがあなたの言いたいことかどうかわかりません。を使ってみることもできますregexp
。
私があなたの質問を正しく理解していれば、文字列に次のような別の文字列が含まれているかどうかを確認するために一致するstrstrを探しています。
<?php
$email = 'http://stackoverflow.com/secretplace/index.html/?someTerm';
$domain = strstr($email, 'someTerm');
if ($domain)
{
// Your 'someTerm' was found in the string.
}
?>