note 129857 added to function.glob

From: Date: Fri, 15 Nov 2024 09:47:52 +0000
Subject: note 129857 added to function.glob
Groups: php.notes 
Request: Send a blank email to php-notes+get-221654@lists.php.net to get a copy of this message
Keep in mind that this function - unlike scandir() - returns not only the filename itself, but also a path in context of the pattern. Which can be either relative or absolute, depending on the value: <?php $absolute = glob("/home/lou/fonts/Graphik*"); $relative = glob("../error-pages\\*.php"); print_r($absolute); print_r($relative); ?> Array ( [0] => /home/lou/fonts/GraphikExtralight.otf [1] => /home/lou/fonts/GraphikLight.otf [2] => /home/lou/fonts/GraphikRegular.otf [3] => /home/lou/fonts/GraphikSemibold.otf ) Array ( [0] => ../error-pages\403.php [1] => ../error-pages\404.php [2] => ../error-pages\500.php ) Notice this also preserves (back)slashes, as they were in pattern. ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.5.137 (proxied: 31.60.93.140) ---- Manual Page -- https://php.net/manual/en/function.glob.php Edit -- https://main.php.net/note/edit/129857 Del: integrated -- https://main.php.net/note/delete/129857/integrated Del: useless -- https://main.php.net/note/delete/129857/useless Del: bad code -- https://main.php.net/note/delete/129857/bad+code Del: spam -- https://main.php.net/note/delete/129857/spam Del: non-english -- https://main.php.net/note/delete/129857/non-english Del: in docs -- https://main.php.net/note/delete/129857/in+docs Del: other reasons-- https://main.php.net/note/delete/129857 Reject -- https://main.php.net/note/reject/129857 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221654) next »