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 156 posted 5 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 166 posted 5 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 290 posted 6 years ago by dragoviandesign
Covnerts an IP address to it's relative hex value.
0 306 posted 6 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 148 posted 7 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 269 posted 7 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 366 posted 7 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 195 posted 8 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 159 posted 8 years ago by vamapaull
Convert rgb color detected by jQuery into hex value.
0 152 posted 8 years ago by macodev
This code is applied from http://www.ultramegatech.com/blog/2009/06/snippet-converting-seconds-to-readable-time/
0 116 posted 8 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 112 posted 8 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 219 posted 8 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 287 posted 8 years ago by f6design
0 203 posted 9 years ago by kspal
Switches 'dd mm yyyy' to 'yyyy-mm-dd'
0 105 posted 9 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 150 posted 9 years ago by lasavior
1 161 posted 9 years ago by frederichoule
0 114 posted 9 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 86 posted 9 years ago by mloberg
#ImageMagick must be installed on server for this operation
6 339 posted 9 years ago by alessio2
0 92 posted 9 years ago by kendsnyder
This method is easy to write, but not very efficient, as you can imagine.
2 256 posted 9 years ago by dyteq
I edit this from tylerhall on 11/30/-1
0 117 posted 9 years ago by redoc
1 101 posted 9 years ago by CJness
Pass in object. Returns array.
0 120 posted 10 years ago by jmiller
This will convert dates from MM-DD-YYYY to YYYY-MM-DD (iso format)
1 169 posted 10 years ago by bradless
« Prev 1 2