私は、文字列を見つけるためにテキストエントリを読むdbテーブルにアクセスしています...その文字列に基づいて、新しい変数を作成します。あなたはいつもあなたが再びmanual's page about the switch
statementを読むことをお勧めしますPHP switch-caseロジックの作業
に終わるだろう
<?php
$haystack = "Additional Licenses: +2 Licenses /br/ Back-up CD-ROM: No";
$needle = "+0";
switch ($needle) {
case '+1':
if (strstr($haystack, $needle)) {
$actpurch = "3";
} else {
break;
}
case '+2':
if (strstr($haystack, $needle)) {
$actpurch = "4";
} else {
break;
}
case '+3':
if (strstr($haystack, $needle)) {
$actpurch = "5";
} else {
break;
}
default:
$actpurch = "2";
break;
}
echo "Activations Purchased: " . $actpurch;
?>
質問がありますか? –