<?php
const CODE_MAP = [
'Reading Comprehension' => 2,
'Elementary Algebra' => 6,
'College Level Math' => 7,
'Sentence Skills' => 1,
'Arithmetic' => 5,
];
const POST_TEST = 'Post Test';
const BASIC_PREFIX = 'AC';
const POST_PREFIX = 'PA';
$BRANCHING_PROFILE = "09. Reading Comprehension - Post Test";
$code = null;
foreach (CODE_MAP as $search => $subCode) {
if (stripos($BRANCHING_PROFILE, $search) === false) {
continue;
}
$prefix = stripos($BRANCHING_PROFILE, POST_TEST) === false ? BASIC_PREFIX : POST_PREFIX;
$code = $prefix . $subCode;
break;
}
var_dump($code);
- Output for 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
- string(3) "PA2"
preferences:
91.98 ms | 408 KiB | 5 Q