Sei uno sforna-classi (funzioni)!
Grande!![]()
Sei uno sforna-classi (funzioni)!
Grande!![]()
è una funzione...Originariamente inviato da PaTeR
Sei uno sforna-classi!
Grande!![]()
![]()
think simple think ringo
Semplicemente spettacolare!!!!
Come faccio però a visualizzare i risultati separati da una virgola, senza tutto l'ambaradan degli array?
What is the |\/|atrix?
Originariamente inviato da |\/|atrix
Semplicemente spettacolare!!!!
Come faccio però a visualizzare i risultati separati da una virgola, senza tutto l'ambaradan degli array?
$combinazioni = &combinatoryDnk( 3, $chars );
$output = '';
for( $a = 0, $b = &count( $combinazioni ); $a < $b; $a++ ) {
$output .= $combinazioni[$a].',';
}
echo substr( $output, 0, -1 );
![]()
Grazie mille e scusate per il disturbo!!
Ciao!![]()
What is the |\/|atrix?
a titolo informativo, ecco una classe che fa tutti i tipi ( almeno credo) di calcolo combinatorio
http://andr3a.dotgeek.org/index.php?language=2&class=58
![]()
Un'ultima cosa...
Vorrei effettuare delle query "whois" in base ai nomi ricavati dalla funzione... ho questo codice ma non mi va.. dov'è l'errore?Graziecodice:<?php function whois($domain, $server="whois.nic.it") { $fp = fsockopen ($server, 43, &$errnr, &$errstr) or die("$errno: $errstr"); fputs($fp, "$domain\n"); $myvar = ''; while (!feof($fp)) $myvar .= fgets($fp, 2048); fclose($fp); return $myvar; } $container = Array( 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'i', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'z' ); function combinatoryDnk( $match, $container ) { $__loop = ''; $__returnedValue = ''; $__limit = &count( $container ); $__myMatches = Array(); for( $a = 0; $a < $match; $a++ ) { $__loop .= 'for( $_'.$a.' = 0; $_'.$a.' < '.$__limit.'; $_'.$a.'++ ) { '; $__returnedValue .= '$container[$_'.$a.'].'; } $__loop .= 'array_push( $__myMatches, '.substr( $__returnedValue, 0, -1 ).' );'; for( $a = 0; $a < $match; $a++ ) { $__loop .= ' }'; } eval( $__loop ); return $__myMatches; } $combinazioni = combinatoryDnk( 3, $container ); $output = ''; for( $a = 0, $b = &count( $combinazioni ); $a < $b; $a++ ) { $output .= $combinazioni[$a]; } $domain = substr( $output, 0, -1 ); $server = "whois.nic.it"; $regex = "/No entries found in the IT-NIC database./"; $myvar = (whois($domain, $server)); if (preg_match($regex, $myvar)) echo "Il dominio ".$domain." è disponibile"; else echo "Il dominio ".$domain." non è disponibile"; ?>
What is the |\/|atrix?
Ho provato anche così ma niente da fare:codice:<?php $server = "whois.nic.it"; $regex = "/No entries found in the IT-NIC database./"; function whois($domain, $server="whois.nic.it") { $fp = fsockopen ($server, 43, &$errnr, &$errstr) or die("$errno: $errstr"); fputs($fp, "$domain\n"); $myvar = ''; while (!feof($fp)) $myvar .= fgets($fp, 2048); fclose($fp); return $myvar; } $container = Array( 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'i', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'z' ); function combinatoryDnk( $match, $container ) { $__loop = ''; $__returnedValue = ''; $__limit = &count( $container ); $__myMatches = Array(); for( $a = 0; $a < $match; $a++ ) { $__loop .= 'for( $_'.$a.' = 0; $_'.$a.' < '.$__limit.'; $_'.$a.'++ ) { '; $__returnedValue .= '$container[$_'.$a.'].'; } $__loop .= 'array_push( $__myMatches, '.substr( $__returnedValue, 0, -1 ).' );'; for( $a = 0; $a < $match; $a++ ) { $__loop .= ' }'; } eval( $__loop ); return $__myMatches; } $combinazioni = combinatoryDnk( 3, $container ); $domain = ''; for( $a = 0, $b = &count( $combinazioni ); $a < $b; $a++ ) { $domain = $combinazioni[$a]; $myvar = (whois($domain, $server)); if (preg_match($regex, $myvar)) echo "Il dominio ".$domain." è disponibile "; else echo "Il dominio ".$domain." non è disponibile "; } ?>
What is the |\/|atrix?