Пример #1
0
</form>
</body>
</html>
<?php 
function topWords($word)
{
    $top = array();
    $word = explode(" ", $word);
    $wordLenght = array();
    foreach ($word as $k => $v) {
        $word[$k] = array('word' => $v, 'length' => mb_strlen($v));
        $wordLenght[] = mb_strlen($v);
    }
    //$wordLenght = array_unique($wordLenght);
    rsort($wordLenght);
    for ($i = 0; $i < 3; $i++) {
        for ($k = 0; $k < count($word); $k++) {
            if (isset($word[$k]) && $word[$k]['length'] == $wordLenght[$i]) {
                $top[] = array('word' => $word[$k]['word'], 'lenght' => $word[$k]['length']);
                unset($word[$k]);
                break;
            }
        }
    }
    return $top;
}
if ($_GET) {
    echo "<pre>";
    var_dump(topWords($_GET['word']));
    echo "</pre>";
}
Пример #2
0
		
        $allAddresses['*****@*****.**'] = "dfs";
        $allAddresses['*****@*****.**'] = "fdfd";
        $allAddresses['*****@*****.**'] = "fdf";
        $allAddresses['*****@*****.**'] = "fd";
        
        $allAddressesReference['*****@*****.**'] = '*****@*****.**';
        $allAddressesReference['*****@*****.**'] = '*****@*****.**';
        $allAddressesReference['*****@*****.**'] = '*****@*****.**';
        $allAddressesReference['*****@*****.**'] = '*****@*****.**';
		*/
getMessages();
logMsg('MEMORY', 'Current allocated memory (after Messages): ' . memory_get_usage());
#detectLanguage();
#logMsg('MEMORY', 'Current allocated memory (after Language Detection): '. memory_get_usage());
topWords();
logMsg('MEMORY', 'Current allocated memory (after Top Words): ' . memory_get_usage());
dumpPhpVar('contacts', $contacts);
dumpPhpVar('allAddressesReference', $allAddressesReference);
dumpPhpVar('contacts', $contacts);
relateContacts();
ksort($contactsRelate);
foreach ($contactsRelate as $key => $relationship) {
    ksort($contactsRelate[$key]);
}
dumpPhpVar('contactsRelate', $contactsRelate);
logMsg('MEMORY', 'Current allocated memory (after Relating Contacts): ' . memory_get_usage());
?>
		<hr>
		<big><a href="display.php">Now go play with the results!!!</a></big>
    </body>