note 119487 added to function.pathinfo
| From: | MauroAlexandre | Date: | Sun, 19 Jun 2016 13:51:10 +0000 |
| Subject: | note 119487 added to function.pathinfo | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205755@lists.php.net to get a copy of this message | ||
O melhor caminho para usar o pathinfo() é primeiro colocar a variável e depois criar um array
com as informações.
$url = pathinfo("www/public_html/index.php");
$array = array_values($url);
Usando esse script você vai ter maior controle na aplicação e quando quiser recuperar cada
valor use o $array.
$url = pathinfo("www/public_html/index.php");
$array = array_values($url);
foreach($array as $arr){
echo $arr."\n";
}
A saÃda será algo como isso:
www/public_html index.php php index
Assim para ter o valor da extensão basta usar:
echo $array[2]; //php
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
The better way for to use function pathinfo() is to putting the variable and after create an array
with the data.
$url = pathinfo("www/public_html/index.php");
$array = array_values($url);
Using this script you will get more control in application and when you want retrieve each value use
the $array.
$url = pathinfo("www/public_html/index.php");
$array = array_values($url);
foreach($array as $arr){
echo $arr."\n";
}
The output will be something as well:
www/public_html index.php php index
To get the extension value use:
echo $array[2]; //php
----
Server IP: 72.52.91.14
Probable Submitter: 179.108.48.5
----
Manual Page -- http://php.net/manual/en/function.pathinfo.php
Edit -- https://master.php.net/note/edit/119487
Del: integrated -- https://master.php.net/note/delete/119487/integrated
Del: useless -- https://master.php.net/note/delete/119487/useless
Del: bad code -- https://master.php.net/note/delete/119487/bad+code
Del: spam -- https://master.php.net/note/delete/119487/spam
Del: non-english -- https://master.php.net/note/delete/119487/non-english
Del: in docs -- https://master.php.net/note/delete/119487/in+docs
Del: other reasons-- https://master.php.net/note/delete/119487
Reject -- https://master.php.net/note/reject/119487
Search -- https://master.php.net/manage/user-notes.php