Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- switch($_GET['kw']){
- case "berlingo":
- include 'berlingo.php'
- break;
- case "c4":
- include 'c4.php';
- break;
- }
- ?>
- $linkKW = $_GET['kw'];
- switch (true){
- case stristr($linkKW,'berlingo'):
- include 'berlingo.php';
- break;
- case stristr($linkKW,'c4'):
- include 'c4.php';
- break;
- }
- $linkKW = $_GET['kw'];
- switch (true){
- case stripos($linkKW,'berlingo') !== false:
- include 'berlingo.php';
- break;
- case stripos($linkKW,'c4') !== false:
- include 'c4.php';
- break;
- }
- if (strpos($_GET['kw'], 'berlingo') !== false) {
- include 'berlingo.php';
- } else if (strpos($_GET['kw'], 'c4') !== false) {
- include 'c4.php';
- } … and so on …
- $map = array('berlingo' => 'berlingo.php', 'c4' => 'c4.php', …);
- foreach ($map as $keyword => $file) {
- if (strpos($_GET['kw'], $keyword) !== false) {
- include $file;
- break;
- }
- }
- $keywords = array('berlingo', 'c4', …);
- foreach ($keywords as $keyword) {
- if (strpos($_GET['kw'], $keyword) !== false) {
- include "$keyword.php";
- break;
- }
- }
- if(strpos($_GET['kw'],'berlingo') !== false) {
- include 'berlingo.php';
- }
- if(strpos($_GET['kw'],'c4') !== false) {
- include 'c4.php';
- }
- $keywords = array('berlingo', 'c4');
- foreach($keywords as $keyword)
- if(strpos($_GET['kw'], $keyword) !== FALSE)
- include("$keyword.php");
- <?php
- $kw = filter_input(INPUT_GET, "kw");
- switch($kw){
- case (preg_match('/*berlingo*/', $kw) ? true : false):
- include 'berlingo.php';
- break;
- case "c4":
- include 'c4.php';
- break;
- }
- ?>
- $map = array('berlingo' => 'berlingo.php', 'c4' => 'c4.php', …);
- if( !isset( $map[$_GET['kw']] ))
- throw new Exception("Blah!!");
- include $map[$_GET['kw']];
- class Haystack {
- public $value;
- public function __construct($value)
- {
- $this->value = $value;
- }
- public function contains($needle):
- {
- if (strpos($this->value, $needle) !== false)
- return $this;
- }
- }
- $kw = new Haystack($_GET['kw']);
- switch ($kw) {
- case $kw->contains('berlingo'):
- require_once 'berlingo.php';
- case $kw->contains('c4'):
- require_once 'c4.php';
- }
- final class Haystack {
- private $value;
- private $isMain;
- public function __construct(string $value, bool $isMain = true)
- {
- $this->value = $value;
- $this->isMain = $isMain;
- }
- final public function contains($needle): Haystack
- {
- if (strpos($this->value, $needle) !== false)
- return $this;
- return new Haystack($needle, false);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement