Valid XHTML    Valid CSS2    

Listing du fichier listefns.php

 

00001     <?php
00002     
00003     
########################################
00004     
00005     
function listeFonctions($fichier) {
00006     
00007     
########################################
00008     
00009     
if (!
file_exists($fichier)) {
00010      print
" Désolé, je ne vois pas le fichier
$fichier\n" ;
00011      exit(-
1) ;
00012      } ;
# fin de si
00013     
00014     
echo
"\n Liste des fonctions du fichier : $fichier\n\n" ;
00015     
00016     
$fh
= fopen($fichier,"r") ;
00017     
$nbl
= 0 ;
00018     
00019      while (!
feof
($fh)) {
00020     
$lig
= fgets($fh, 4096) ;
00021      if (
strlen
($lig)>0) {
00022     
$nbl++ ;
00023     
## pour debug : echo "$nbl : $lig\n" ;
00024     
$tdm
= preg_split("/\s+/",trim($lig)) ;
00025      if (
$tdm
[0]=="function") {
00026      echo
sprintf
("%04d",$nbl)." : $lig\n" ;
00027      } ;
# fin de si
00028     
} ; # fin si
00029     
} ; # fin tant que
00030     
00031     
fclose
($fh) ;
00032     
00033      }
# fin de fonction listeFonctions
00034     
00035     // exemple d'appel :
00036     
00037     ###############################################
00038     #
00039     # listeFonctions("fonction_prot.php") ;
00040     #
00041     ###############################################
00042     
00043     /*
00044     Résultat :
00045     
00046     @janus~/public_html/internet|(~gH) > php -a
00047     Interactive mode enabled
00048     php > include("listefns.php") ;
00049     php > listeFonctions("fonction_prot.php") ;
00050     
00051     Liste des fonctions du fichier : fonction_prot.php
00052     
00053     0010 : function url_genpept($num_prot) {
00054     0018 : function url_uniprot($num_prot) {
00055     0026 : function url_pfam($num_prot) {
00056     0032 : function url_cdd($num_prot) {
00057     0039 : function url_fasta($num_prot) {
00058     0045 : function fasta_to_str($fasta) {
00059     0055 : function get_fasta($accession) {
00060     0069 : function calcul_mw($fasta)
00061     0102 : function calcul_pi($fasta)
00062     0165 : function compo_aa($fasta,$a)
00063     
00064     php > quit
00065     
00066     */
00067     
?>

Pour ne pas voir les numéros de ligne, ajoutez &nl=non à la suite du nom du fichier.

 

 

retour gH    Retour à la page principale de   (gH)