1--TEST-- 2SPL: SplFileInfo::getExtension() basic test 3--SKIPIF-- 4<?php 5if (PHP_OS_FAMILY === "Windows") die("skip not for Windows"); 6?> 7--FILE-- 8<?php 9$file = md5('SplFileInfo::getExtension'); 10$exts = array('.txt', '.extension', '..', '.', ''); 11foreach ($exts as $ext) { 12 touch($file . $ext); 13 $info = new SplFileInfo($file . $ext); 14 var_dump($info->getExtension(), pathinfo($file . $ext, PATHINFO_EXTENSION)); 15} 16?> 17--CLEAN-- 18<?php 19$file = md5('SplFileInfo::getExtension'); 20$exts = array('.txt', '.extension', '..', '.', ''); 21foreach ($exts as $ext) { 22 @unlink($file . $ext); 23} 24?> 25--EXPECT-- 26string(3) "txt" 27string(3) "txt" 28string(9) "extension" 29string(9) "extension" 30string(0) "" 31string(0) "" 32string(0) "" 33string(0) "" 34string(0) "" 35string(0) "" 36