3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_SESSION['person_role'] = 'admin'; // set for testing demo // Either do your switch case and set variables... $page = "default"; $role = "default"; switch($_SESSION['person_role']) { case 'admin': $page = $role = "admin"; break; case 'operator': $page = $role = "operator"; break; case 'partner': $page = $role = "partner"; break; } ?> Example W/ Switch Case.. <ul> <li class="uk-margin-left uk-margin-right"><a href="<?php echo $page; ?>.html"><?php echo ucwords($role); ?></a></li> </ul> <?php // - OR - // Just use $_SESSION data (assuming sanitized) in the HTML... $_SESSION['person_role'] = 'operator'; // set for testing demo ?> Example just using $_SESSION data.. <ul> <li class="uk-margin-left uk-margin-right"><a href="<?php echo $_SESSION['person_role']; ?>.html"><?php echo ucwords($_SESSION['person_role']); ?></a></li> </ul>

preferences:
52.3 ms | 402 KiB | 5 Q