Welcome To Snipplr


Everyone's Recent PHP Snippets Tagged function



1 2 3 Next »
Used to cleanly truncate text.
0 996 posted 16 years ago by jspicher
Convert a string to number.
0 883 posted 16 years ago by jspicher
This makes template code that applies to children of a particular page much more readable, especially if you can use a page path instead of an ID: `if ( is_child_of( 'topic/subtopic' ) ) :`.
1 1301 posted 16 years ago by cyberhobo
0 953 posted 16 years ago by zemin
very useful function that allows you to redirect to the user to a given location
1 1380 posted 16 years ago by daveismyname
0 1304 posted 16 years ago by iTony
2 1647 posted 16 years ago by iloveitaly
closes opened tags in text piece. original code slightly modified to supress PHP warnings NOTE: need to fix the order of closing tags to get standards compliance
0 1190 posted 16 years ago by kossmoss
Returns last word of a string (words separated by blanks). if string does not have any blanks, it will return the whole string.
1 1270 posted 16 years ago by fischkopp
Well, not the best one...
1 1283 posted 16 years ago by Sn0opy
it already exists in php
1 1185 posted 16 years ago by ginoplusio
0 1092 posted 16 years ago by iTony
Secure, Advanced, Better, Faster... function for remove/strip tags(Anti-XSS).
2 2030 posted 16 years ago by YPY
1 1425 posted 16 years ago by iTony
it needs the GD2 library
5 1613 posted 17 years ago by iTony
0 1343 posted 17 years ago by stavelin
1 1028 posted 17 years ago by iTony
This will count sentences that end in . or ? or ! and have a space after them.
1 2772 posted 17 years ago by evanwalsh
Another way of showing long text to end user...
0 1329 posted 17 years ago by skywalker
1 1554 posted 17 years ago by iTony
A small function I made to chmod directories and files recursively, with different permissions.
2 1937 posted 17 years ago by Tenzer
Add this template before functions in a library, in order to give a good description of what it is and what it does. Replace all in < and > with your values.
2 1640 posted 17 years ago by engel
Pass a user-inputted variable to this function in order to prevent SQL injection. Example: mysql_query("INSERT INTO table VALUES('" . sql_sanitize($_POST["variable") . "')"); Instead of: mysql_query("INSERT INTO table VALUES('" . $_POST["var...
34 10189 posted 17 years ago by engel
1 997 posted 18 years ago by drwitt
This PHP4 function will increment a given string by a given interval. This might be useful when a string has to be unique. An optional array with "forbidden" return values may be passed. Usage:
2 1498 posted 18 years ago by drwitt
This function first checks to see if PHP is set to automagically quote stuff. If it is, we first strip pre-quoted stuff, then (assuming our text isn't numeric), we properly quote everything. A good bit of room for improvement here, but at the very l...
1 1124 posted 19 years ago by sorehead
0 1471 posted 19 years ago by gdonald
0 1718 posted 19 years ago by janez
1 2 3 Next »