Welcome To Snipplr


Everyone's Recent PHP Snippets Tagged convert



« Prev 1 2
I can't say I can rely on mb_detect_encoding(). Had some freaky false positives a while back. The following code will detect when you need to enconde or decode it.
1 2808 posted 10 years ago by fackz
This function takes HTML input and converts it to plain text. It needs improvement so that it converts multiple blank lines to a single blank line and converts an <a ... > link to the markup equivalent (same for images). It should be rewritten...
0 3100 posted 11 years ago by nigelnquande
This snippets converts a file called 'test.mp3' in the same folder, to a file called 'test.ogg' and saves it in the same folder as well
0 3566 posted 12 years ago by dragoviandesign
Covnerts an IP address to it's relative hex value.
0 4676 posted 12 years ago by martyncoup
This function returns the duration of the given time period in days, hours, minutes and seconds. For example: echo convertSecToStr('654321'); would return "7 days, 13 hours, 45 minutes, 21 seconds"
0 2929 posted 13 years ago by apphp-snippets
This useful function will convert a time in seconds to a time in years, months, weeks, days, and so on.
0 3808 posted 13 years ago by goo
Convert 12-hour time format with hour, minutes, seconds, and meridiem into 24-hour format. Performs data correction to make sure hours, minutes and seconds have leading zeros if needed. The trick here is to use strtotime() where we pass the time...
0 6446 posted 13 years ago by kosinix
For those cases where you want to code in PHP but need to deploy to ASP. It doesn't account for php logic but only converts the php include() statements into SSI includes. Could be useful for converting basic websites from php to asp, rare but it hap...
0 2995 posted 14 years ago by crypticsoft
This PHP code is made to help people using the ActionScript 3 AlivePDF library to save PDF files from a Flash app to a server. ActionScript 3 AlivePDF save code: _pdf.save(Method.REMOTE, "save.php", Download.ATTACHMENT, "MyFile.pdf");
0 2932 posted 14 years ago by vamapaull
Convert rgb color detected by jQuery into hex value.
0 1934 posted 14 years ago by macodev
This code is applied from http://www.ultramegatech.com/blog/2009/06/snippet-converting-seconds-to-readable-time/
0 1520 posted 14 years ago by zierocode
This function accept one parameter (integer or float) and returns the same number writed with words. Useful for currencies and invoices.
0 2523 posted 14 years ago by stz184
This is a very rudimentary function used to convert a Datetime delivered by the Twitter API to a format you can store in MySQL's datetime field.
0 2692 posted 14 years ago by aristoworks
Sometimes a legacy database will have HTML entities stored in it. This function converts them. Note that this function assumes you have a database abstraction layer, and may need to be modified to connect to YOUR database.
0 4418 posted 14 years ago by f6design
0 2348 posted 14 years ago by kspal
Switches 'dd mm yyyy' to 'yyyy-mm-dd'
0 1641 posted 14 years ago by nebojsac
Takes a number (no decimal) and converts it to written words.Why'd i write it to be able to do such big numbers? Why not? Note: The numbers next to the 'thousandfoldnums' are for your reference (thats how many zeros/places there are in that numbe...
0 1953 posted 14 years ago by lasavior
1 2274 posted 15 years ago by frederichoule
0 1555 posted 15 years ago by takel
This simply takes an array and coverts it to variables. E.g. If you had an array, $array = array("key" => "value"), after running this script, $key would be "value".
0 1626 posted 15 years ago by mloberg
#ImageMagick must be installed on server for this operation
6 3174 posted 15 years ago by alessio2
0 1692 posted 15 years ago by kendsnyder
This method is easy to write, but not very efficient, as you can imagine.
2 2791 posted 15 years ago by dyteq
I edit this from tylerhall on 11/30/-1
0 1565 posted 15 years ago by redoc
1 1587 posted 15 years ago by CJness
Pass in object. Returns array.
0 1675 posted 15 years ago by jmiller
This will convert dates from MM-DD-YYYY to YYYY-MM-DD (iso format)
1 2054 posted 16 years ago by bradless
« Prev 1 2