English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Tutorial Básico PHP

Tutorial Avançado PHP

PHP & MySQL

Manual de Referência PHP

Uso e exemplo da função dirname() PHP

PHP Filesystem Referência

A função dirname() pode retornar o nome do diretório a partir do caminho.

Sintaxe

string dirname ( string caminho )

Exemplo online

<?php
   echo dirname("C:/PhpProject/index.php") . "\n";
   echo dirname("/PhpProject/index.php");
?>

Resultado de saída

C:/PhpProject
/PhpProject

PHP Filesystem Referência