method getExtension documentation in bbn\File

Return the extension of the file.

Example

$file = new File('C:/Test/file.txt'); X::dump($file->getExtension()); //(string) 'txt' function() { if ($this->name && is_null($this->ext)) { if (strrpos($this->name, '.')) { $p = Str::fileExt($this->name, 1); $this->ext = $p[1]; $this->title = $p[0]; } else{ $this->ext = ''; $this->title = substr($this->name,-1) === '/' ? substr($this->name,0,-1) : $this->name; } } return $this->ext ?: ''; }

Return the extension of the file. BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.