$info_selector_bullshit = '.row'; function getSomething($selector) { $content = getContent(); $features = $content->find($selector); echo '<hr>'; foreach ($features as $feature) { echo $feature->plaintext . '<p>'; } } if ($_GET) { switch ($_GET['p']) { case 1: getSomething($feature_selector); break; case 2: getSomething($price_selector); break; case 3: getSomething($info_selector_bullshit); break; } } ?> <div align="left"> <a href="/?p=1">Features</a><br> <a href="/?p=2">Prices</a><br> <a href="/">back</a><br> </div>
<?php var_dump(isset($_GET['test']) ? $_GET['test'] : null); function getSomething() { $a = new stdClass(); $b = []; return $a ?: $b; } var_dump(getSomething());