![]() |
|
![]()
![]()
![]()
![]()
![]()
![]()
|
![]() Convert to Roman numbers in PHP
Here’s a nifty coding which I’ve found on the net on displaying Roman number like I II III IV etc.
<?php // A function to return the Roman Numeral, given an integer private function numberToRoman($num) { // Make sure that we only use the integer portion of the value $n = intval($num); $result = ”; // Declare a lookup array that we will use to traverse the number: $lookup = array(’M’ => 1000, ‘CM’ => 900, ‘D’ => 500, … How to: Delete a folder with all files inside
We all know we can find a PHP code to delete a directory, but to delete a directory will thousands and millions of files in it? Here’s the coding which is quite a hassle to find, and I’m sharing it with y’all.
function del_dir($dir)
{
$res = @opendir($dir);if(!$res) return;
while(($file = readdir($res)) !== false)
{
if($file !== ‘.’ && $file !== ‘..’)
{
$f = $dir . ‘/’ . $file;
if(is_dir($f))
{
del_dir($f);
}
else
{
@unlink($f);
}
}
}
closedir($res);
@rmdir($dir);
}
Save the code above to a single PHP file …
|
|
© Copyrights DSDexigns.Com 2008 | Powered Wordpress 2.5.1 | Flavored Shades By Andy D. Hajime | Proudly Hosted Pacific Asia Technologies DSDexigns by Andy D. Hajime is licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 License. Views, Contents, Elements and Usage of DSDexigns.Com are based on your agreement to our Terms of Use and Policies. |
|