$haystackCount = strlen($haystack); $needleAantal = substr_count($haystack, $needle); $needleProcent = $needleAantal / $haystackCount * 100; return $needleProcent; } function telKarakters3($needle) { $haystack = $GLOBALS['md5HashKey']; $haystackCount = strlen($haystack); $needleAantal = substr_count($haystack, $needle); $needleProcent = $needleAantal / $haystackCount * 100; return $needleProcent; } $eersteMethode = telKarakters1($md5HashKey, $needle1); $tweedeMethode = telKarakters2($needle2); $derdeMethode = telKarakters3($needle3); ?> <!DOCTYPE html> <html> <head> <title>Oplossing functies gevorderd: deel1</title> </head> <body> <h1>Oplossing functies gevorderd: deel1</h1> <pre><?php // var_dump ( $GLOBALS ) ?> </pre>
$keyCount = strlen($key); $searchAantal = substr_count($key, $search); $searchProcent = $searchAantal / $keyCount * 100; return $searchProcent; } function telKarakters3($search) { $key = $GLOBALS['md5HashKey']; $keyCount = strlen($key); $searchAantal = substr_count($key, $search); $searchProcent = $searchAantal / $keyCount * 100; return $searchProcent; } $eersteMethode = telKarakters1($md5HashKey, $search1); $tweedeMethode = telKarakters2($search2); $derdeMethode = telKarakters3($search3); ?> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Opdracht functies gevorderd</title> <link rel="stylesheet" href="http://web-backend.local/css/global.css"> <link rel="stylesheet" href="http://web-backend.local/css/facade.css"> <link rel="stylesheet" href="http://web-backend.local/css/directory.css"> </head> <body class="web-backend-opdracht"> <section class="body"> <h1>Opdracht functies gevorderd: deel 1</h1>