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 737 posted 8 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 872 posted 9 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 1407 posted 9 years ago by dragoviandesign
Covnerts an IP address to it's relative hex value.
0 2053 posted 10 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 753 posted 11 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 1340 posted 11 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 3644 posted 11 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 822 posted 11 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 798 posted 12 years ago by vamapaull
Convert rgb color detected by jQuery into hex value.
0 717 posted 12 years ago by macodev
This code is applied from http://www.ultramegatech.com/blog/2009/06/snippet-converting-seconds-to-readable-time/
0 604 posted 12 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 751 posted 12 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 1248 posted 12 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 1868 posted 12 years ago by f6design
0 1004 posted 12 years ago by kspal
Switches 'dd mm yyyy' to 'yyyy-mm-dd'
0 587 posted 12 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 757 posted 12 years ago by lasavior
1 807 posted 12 years ago by frederichoule
0 543 posted 13 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 559 posted 13 years ago by mloberg
#ImageMagick must be installed on server for this operation
6 1522 posted 13 years ago by alessio2
0 539 posted 13 years ago by kendsnyder
This method is easy to write, but not very efficient, as you can imagine.
2 1079 posted 13 years ago by dyteq
I edit this from tylerhall on 11/30/-1
0 568 posted 13 years ago by redoc
1 569 posted 13 years ago by CJness
Pass in object. Returns array.
0 670 posted 13 years ago by jmiller
This will convert dates from MM-DD-YYYY to YYYY-MM-DD (iso format)
1 910 posted 13 years ago by bradless
« Prev 1 2