pathinfo

(PHP 4 >= 4.0.3, PHP 5)

pathinfo -- Restituisce informazioni su un percorso di file

Descrizione

array pathinfo ( string path)

pathinfo() restituisce un vettore associativo contenente informazioni riguardo path. Nel vettore vegono riportati i seguenti elementi: dirname, basename e extension.

Esempio 1. pathinfo() Example

<?php

$path_parts
= pathinfo("/www/htdocs/index.html");

echo
$path_parts["dirname"] . "\n";
echo
$path_parts["basename"] . "\n";
echo
$path_parts["extension"] . "\n";

?>

produrra:

/www/htdocs
index.html
html

Nota: Per maggiori dettagli sul recupero del percorso corrente, leggere la sezione variabili predefinite riservate.

Vedere anche dirname(), basename(), parse_url() e realpath().