Welcome To Snipplr
Everyone's Recent PHP Snippets Tagged function
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
use anonymous function that returns parameter passed to it to evaluate functions, constants, and expressions in HEREDOC
0
1107
posted 10 years ago by Queue
Checks if two given arrays equal each other as php doesn't have a built in function for this.
0
828
posted 11 years ago by MaxHudson
To set cookie use "cookie('name of your cookie','cookie data','expire date ')" it will set your cookie in the user browser .
To get the saved cookie use "cookie('name of your cookie')" it will give you the value of the cookie which you saved in the...
0
823
posted 11 years ago by kameshsoft
This function dosen't use curl, or any other libraries. Just include it in your function library and use it like this:
$Post_result = _post('http://www.yourdomain.com/your_path/post_api.php',"method=fetchJson¶ms=select * from user");
0
996
posted 12 years ago by halk
This function will force a file to be downloaded. It accepts $_path as a parameter.
1
982
posted 12 years ago by o0110o
This function performs several checks to make sure it's getting the correct IP address.
1
1218
posted 12 years ago by o0110o
A handy function to get the contents of a file with curl. Accepts $_path as a parameter.
1
1125
posted 12 years ago by o0110o
This function will use curl to see if a file exists at the location it's provided. It accepts $_path as a parameter.
1
1309
posted 12 years ago by o0110o
A function to get a files size via curl. Accepts $_path, $_unit, $_float, $_username & $_password; In the listed order.
1
1292
posted 12 years ago by o0110o
This is a function to retrieve the mime-type of a file by checking the header response with curl. It accepts the file-path as a parameter & it also has a fallback for empty returns.
1
1631
posted 12 years ago by o0110o
Use: echo format_size(filesize("fichier"));
Example result: 13,37 Ko
0
890
posted 12 years ago by zhyar
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
4063
posted 12 years ago by kosinix
Function to prevent sql injection in Like queries, where the characters '_' and '%' can be dangerous.
0
1102
posted 12 years ago by TimoZachi
If you want to use this in a class, change the last line to:
` return array_map(array($this, __FUNCTION__), $object ); `
0
774
posted 12 years ago by jgomez
This is a function that receives a string as an argument (along with other config optional arguments) and locates all keywords (words that appear most) from that string, returning the keywords as an array or as a string separated by commas. The funct...
2
3174
posted 12 years ago by TimoZachi
A custom breadcrumb function for WordPress that I created for a client.
You can pass 2 arguments, the first being the text you want to display in front of the breadcrumb and the second is to hide the home item in the breadcrumb
It will give eac...
1
750
posted 13 years ago by krike
The function returns the "sanitized" version of user input. Use before putting variables into SQL code.
0
819
posted 13 years ago by nebojsac
A print_r replacement function that can handle nested arrays and strings.
Usage: printr($array);
0
706
posted 13 years ago by tasmanweb