Listing du fichier listefnsV2-inc.php
00001<?php
00002 # # (gH) -_- listefnsV2-inc.php ; TimeStamp (unix) : 22 Novembre 2017 vers 16:08
00003
00004 ##################################################################################################
00005
00006 function souligne($texte="",$cds="=") { # cds = caractère de soulignement
00007
00008 ##################################################################################################
00009
00010 $lng = strlen($texte) ;
00011 $chn = "" ;
00012 for ($idc=1;$idc<=$lng;$idc++) {
00013 $chn .= $cds ;
00014 } ; # fin pour idc
00015 return( $chn) ;
00016 } # fin de fonction souligne
00017
00018 ##################################################################################################
00019
00020 function dateEtHeure() {
00021
00022 ##################################################################################################
00023
00024 return( date('d/m/Y') . " " . date('H:i') ) ;
00025
00026 } # fin de fonction dateEtHeure
00027
00028 ##################################################################################################
00029
00030 function nbMots($chen="") {
00031
00032 ##################################################################################################
00033
00034 # renvoie le nombre de mots de la chaine
00035
00036 $phrase = $chen ;
00037 $phrase = chop(trim($phrase)) ;
00038 if (strlen($phrase)==0) { return 0 ; } ;
00039 $tmots = preg_split("/\s+/",$phrase) ;
00040 $nbm = count($tmots) ;
00041 return($nbm) ;
00042
00043 } # fin de fonction nbMots
00044
00045 ##################################################################################################
00046
00047 function mot($chen="",$num=0) {
00048
00049 ##################################################################################################
00050
00051 # renvoie le n-ième mot d'une phrase
00052
00053 $phrase = $chen ;
00054 $phrase = chop(trim($phrase)) ;
00055 if (strlen($phrase)==0) { return "" ; } ;
00056 if ($num<=0) { return "" ; } ;
00057 $tmots = preg_split("/\s+/",$phrase) ;
00058 if ($num>count($tmots)) { return "" ; } ;
00059 $lm = $tmots[$num-1] ;
00060 return trim($lm) ;
00061
00062 } # fin de fonction mot
00063
00064 ##################################################################################################
00065
00066 function phraseSansPremierMot($chen="") {
00067
00068 ##################################################################################################
00069
00070 $phrase = $chen ;
00071 $phrase = chop(trim($phrase)) ;
00072 if (strlen($phrase)==0) { return "" ; } ;
00073 $tmots = preg_split("/\s+/",$phrase) ;
00074 $tmots[0] = "" ;
00075 return(join(" ",$tmots)) ;
00076
00077 } # fin de fonction phraseSansPremierMot
00078
00079 ##################################################################################################
00080
00081 function positionDans($leMot="",$phrase="") {
00082
00083 ##################################################################################################
00084
00085 $leMot = trim($leMot) ;
00086 $phrase = trim($phrase) ;
00087 if (strlen($leMot)==0) { return 0 ; } ;
00088 if (strlen($phrase)==0) { return 0 ; } ;
00089 $nbm = nbMots($phrase) ;
00090 for ($idm=1;$idm<=$nbm;$idm++) {
00091 if ($leMot==mot($phrase,$idm)) { return $idm ; } ;
00092 } ; # fin pour idm
00093 # si on arrive ici, c'est qu'on n'a pas vu le mot
00094 return(0) ;
00095 } # fin de fonction positionDans
00096
00097 ##################################################################################################
00098
00099 function nbLignes($fic="") {
00100
00101 ##################################################################################################
00102
00103 if ($fic=="") { return 0 ; } ;
00104 $fc = file_get_contents($fic) ;
00105 $tl = preg_split("/\n/",$fc) ;
00106 return(count($tl)) ;
00107
00108 } # fin de fonction nbLignes
00109
00110 ##################################################################################################
00111 ?>
Pour ne pas voir les numéros de ligne, ajoutez &nl=non à la suite du nom du fichier.
Retour à la page principale de (gH)