我有这个字符串:v531123000
如果它包含字符串v531
,我想要测试。
我是strpos
做到的,但它不起作用:
$pn = $article->getPartNumber();
if (strpos($pn, 'v531') !== false) {
$lt=30;
}
我应该搜索另一个不是strpos
的功能吗?
答案 0 :(得分:0)
if (0 === strpos('v531123000', 'v531')) {
//The String starts 'v531'
}