note 119487 deleted from function.pathinfo by cmb

From: Date: Sun, 19 Jun 2016 15:18:55 +0000
Subject: note 119487 deleted from function.pathinfo by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-205756@lists.php.net to get a copy of this message
Note Submitter: Mauro Alexandre ---- 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

« previous php.notes (#205756) next »