PHP: Convert while loop in array -


how convert below result array? want make array can assign variable , use it

if($handle = opendir($path)){     while(false != ($filename = readdir($handle))) {         if($filename != "." && $filename != ".."){             $name = preg_replace("/\\.[^.\\s]{3,4}$/", "", $filename);             $name = str_replace('_', ' ', $name);             $name = ucwords($name);                 echo $name;         }                }     closedir($handle); } 

simply add names array....

$files = array(); if($handle = opendir($path)){     while(false != ($filename = readdir($handle))) {         if($filename != "." && $filename != ".."){             $name = preg_replace("/\\.[^.\\s]{3,4}$/", "", $filename);             $name = str_replace('_', ' ', $name);             $name = ucwords($name);             $files[] = $name;         }                }     closedir($handle); } 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -