- substr: documentation ( source)
- strpos: documentation ( source)
<?php
$p = array(
'test' => 7,
'checkbox_2' => 'on',
'checkbox_4' => 'on',
'checkbox_10' => 'on',
'Submit' => '',
'name' => 20,
);
foreach ($p as $key => $val) {
//if (substr($key, 0, strlen('checkbox_')) == 'checkbox_') {
if (strpos($key, 'checkbox_') === 0) {
echo substr($key, strlen('checkbox_')) . PHP_EOL;
}
}