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 527 posted 7 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 605 posted 7 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 1026 posted 8 years ago by dragoviandesign
Covnerts an IP address to it's relative hex value.
0 1344 posted 8 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 545 posted 9 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 916 posted 9 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 2248 posted 10 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 575 posted 10 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 555 posted 10 years ago by vamapaull
Convert rgb color detected by jQuery into hex value.
0 531 posted 10 years ago by macodev
This code is applied from http://www.ultramegatech.com/blog/2009/06/snippet-converting-seconds-to-readable-time/
0 446 posted 10 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 439 posted 10 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 915 posted 10 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 1291 posted 10 years ago by f6design
0 745 posted 11 years ago by kspal
Switches 'dd mm yyyy' to 'yyyy-mm-dd'
0 390 posted 11 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 488 posted 11 years ago by lasavior
1 546 posted 11 years ago by frederichoule
0 375 posted 11 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 375 posted 11 years ago by mloberg
#ImageMagick must be installed on server for this operation
6 1057 posted 11 years ago by alessio2
0 386 posted 11 years ago by kendsnyder
This method is easy to write, but not very efficient, as you can imagine.
2 768 posted 11 years ago by dyteq
I edit this from tylerhall on 11/30/-1
0 406 posted 11 years ago by redoc
1 371 posted 11 years ago by CJness
Pass in object. Returns array.
0 474 posted 12 years ago by jmiller
This will convert dates from MM-DD-YYYY to YYYY-MM-DD (iso format)
1 610 posted 12 years ago by bradless
« Prev 1 2