Ciao. AVrei bisogno di fare qualcosa di simile ad un codice fiscale. In pratica ho
3 parole. dalle prima due estrapolo solo le consonanti, dalla terza le prime due lettere.
Conoscete qlk funzione utile? grazie mille..ciaoo
Ciao. AVrei bisogno di fare qualcosa di simile ad un codice fiscale. In pratica ho
3 parole. dalle prima due estrapolo solo le consonanti, dalla terza le prime due lettere.
Conoscete qlk funzione utile? grazie mille..ciaoo
http://codecanyon.net/category/all?ref=Manuelandro
And I bet she told a million people that she'd stay in touch, Well all the little promises they dont mean much,When theres
memories to be made
Codice PHP:
function codice($stringa){
preg_match_all("#\\w+#",$stringa,$words);
if ( count($words[0]) < 3) {
echo 'meno di 3 parole';
return false;
}
$vocali = array("a", "e", "i", "o", "u", "A", "E", "I", "O", "U");
$str = '';
for ($i=0;$i<=1;$i++) {
$str.= str_replace($vocali,'',$words[0][$i]);
}
$str.= substr($words[0][2],0,2);
return $str;
}
scusami, le 3 paole nn sono una stringa, ma 3 variabili diverseOriginariamente inviato da nicola75ss
Codice PHP:
function codice($stringa){
preg_match_all("#\\w+#",$stringa,$words);
if ( count($words[0]) < 3) {
echo 'meno di 3 parole';
return false;
}
$vocali = array("a", "e", "i", "o", "u", "A", "E", "I", "O", "U");
$str = '';
for ($i=0;$i<=1;$i++) {
$str.= str_replace($vocali,'',$words[0][$i]);
}
$str.= substr($words[0][2],0,2);
return $str;
}
http://codecanyon.net/category/all?ref=Manuelandro
And I bet she told a million people that she'd stay in touch, Well all the little promises they dont mean much,When theres
memories to be made
Originariamente inviato da Manuelandro
scusami, le 3 paole nn sono una stringa, ma 3 variabili diverseCodice PHP:
$parola1 = 'pippo';
$parola2 = 'pluto';
$parola3 = 'paperino';
$vocali = array("a", "e", "i", "o", "u", "A", "E", "I", "O", "U");
$str = str_replace($vocali,'',$parola1);
$str.= str_replace($vocali,'',$parola2);
$str.= substr($parola3,0,2);
echo $str;
grazie mille. sei stato gentilissimo.
Un ultimo chiarimento se posso, devo completare questa sorta di codice fiscale inserendo nella stringa anche una data formattata e cioè
ppppltpa + 151206 (presi dal campo data 2006-12-15)
come faccio?
grazie ancora per l'aiuto!
http://codecanyon.net/category/all?ref=Manuelandro
And I bet she told a million people that she'd stay in touch, Well all the little promises they dont mean much,When theres
memories to be made
Codice PHP:
$data = '2006-12-15';
$arr = explode('-',$data);
$str = $arr[2].$arr[1].substr($arr[0],2,2);
echo $str;
mito
http://codecanyon.net/category/all?ref=Manuelandro
And I bet she told a million people that she'd stay in touch, Well all the little promises they dont mean much,When theres
memories to be made