Welcome To Snipplr


Everyone's Recent PHP Snippets



strcmp with matching strings took 0.207852 seconds strcmp with non-matching strings took 0.215276 seconds === with matching strings took 0.067122 seconds === with non-matching strings took 0.057305 seconds === is the clear winner. Function call...
0 1101 posted 15 years ago by mthorn
Often PHP can't interpret POST data because it is not form-encoded. This is typical when the post data is XML from API's like Flash's XmlSocket. You can use the following methods to read the POST data directly.
1 641 posted 15 years ago by mthorn
Since PHP is typeless odd things can happen when a variable is not the type you expected. PHP treats 0, null, '0', false, and '' as false. Sometimes you really want to know if the value is false. The solution is simple, use the triple equal (===) ope...
0 416 posted 15 years ago by mthorn
Will create a thumnail no taller or wider than the supplied size. Also contains some tips for reading and writing images using GD.
22 1887 posted 15 years ago by mthorn
Sends as XHTML 1.1 + MathML if supported, falls back to XHTML 1.1 if supported, or falls back to HTML 4.01 Strict. Mixed two separate scripts: http://www.workingwith.me.uk/articles/scripting/mimetypes http://golem.ph.utexas.edu/~distler/blog/arc...
2 301 posted 15 years ago by rolandog
Extraido de Good PHP Tutorials, un articulo de Tim Bennett
1 274 posted 15 years ago by mate
This script reads a directory of files. After reading the directory specified it outputs the directory files. Upon output, supplied functions manipulate each filename and format it to make the output filename look better. e.g.: instead of output bei...
2 456 posted 15 years ago by drewrockshard
0 322 posted 15 years ago by methnen
makes a resized duplicate of an image
0 326 posted 15 years ago by jkochis
2 282 posted 15 years ago by mail_json
from openbusiness.cc
2 357 posted 15 years ago by ringo
this is from openbusiness.cc statistics code.
2 442 posted 15 years ago by ringo
You should edit your WordPress plugin so that the $source variable at the end shows this value. Though it is a shame that code can't have an 'ol' as a childNode, and neither can the pre element. Couldn't find any way of making it all fit: http://lear...
3 349 posted 15 years ago by rolandog
usage is simple: $result = mysqli_query($query,db_conn('local')); for instance. if written in patterns, this should probably be a singleton, but I haven't bothered converting it - feel free to comment with your modification though!
3 341 posted 15 years ago by Aeon
Not a great solution will need to look further at why files are being sent in binary form Add this to the mime types array in the Upload class
3 385 posted 15 years ago by benpjohnson
0 391 posted 15 years ago by nicolaspar
This function split a several lines long text into an array. It works with Windows and Linux texts.
4 336 posted 15 years ago by katxorro70
0 551 posted 15 years ago by janez
I use this object verry often, so that I only need to pass one object as parameter on any function. No need to wory when we refactore the function Usage: $var = new open(); $var->url = 'http://www.world.com'; $var->title = 'Testing Site'; ech...
1 411 posted 15 years ago by ekobudisetiyo
这个问题出现在home.php中。 from:天佑 在 home.php 中 $myrecentposts 內的 SQL 是用 post_date 和 NOW() 作比較. NOW() 這個 function 是會以 server 的 timezone 讀取現時的時間,但 post_date 這個 field 的 timezone...
0 240 posted 15 years ago by championeer
4 460 posted 15 years ago by jkochis
Exclude Posts From Some Category 这样就可以在首页中不显示某些类别(比如asides)的帖子了
1 532 posted 15 years ago by championeer
http://rossoft.wordpress.com
1 410 posted 15 years ago by jonbaer
Fetch the results of a MySQL query.
4 400 posted 15 years ago by neogeek
Fetch a list of tables in a specific database.
7 515 posted 15 years ago by neogeek
Fetch a list of available databases.
7 499 posted 15 years ago by neogeek
Similar to the file_put_contents() function in PHP5 built for PHP4 (will not cause errors on a server running PHP5).
0 472 posted 15 years ago by neogeek
1 371 posted 2022 years ago by KernelPanic
A quick and simple way to search a MySQL database. Example: mysql_search('items', 'title tags', isset($_GET['q'])?$_GET['q']:'', Array('columns'=>'*', 'method'=>'OR', 'extra_sql'=>'AND active = "true" ORDER BY id DESC'));
67 2476 posted 15 years ago by neogeek