- strpos: documentation ( source)
<?php
$signexceptions = array('2' => 'Z','1' => 'P');
$code = '100';
foreach($signexceptions as $se => $type){
//checken als code begint met exception en mag maar 1 keer checken
if( strpos($code,(string)$se) === 0){
echo $se.' YES'.PHP_EOL;
}
else{
echo $se.' NO'.PHP_EOL;
}
}