1.我有兩個字符串1.abc和2.abc_1,我比較這兩個字符串第二個字符串有兩個額外字符,比較後如何返回這些字符在PHP中。 2.如果字符串不以「_1」結尾,如果字符串以「_1或(任何數字值)」結尾,我想添加「_1」,我想爲該值添加+1,如何在php中執行此操作。如何比較兩個字符串如果最後兩個字符不匹配則返回那些字符
$jobref='abc';
$newjobref='abc_1';
if(strcasecmp($jobref,$newjobref)==0)
{
//here i want to add _1 to that string
}
else
{
//return last two character
if(last character == (any numeric value))
{
//add plus 1 to that value
}
}
感謝您的代碼讓我試試這一個 –
是否奏效,@ M.Athishkrishna? – Martin
nope根據我的招聘人數進行一些更正 –