Profile

Achievement

first submission:submitting first snipplet

apphp-snippets's Recent Snippets



1 2 3 Next »
You can use JavaScript window.location to redirect a visitor to a required page. You may have seen this feature used by sites with full page ads, or to redirect visitors to the site's new domain name. You can add also a timer to the script that will...
2 606 posted 8 years ago by apphp-snippets
This example of code shows how to do a simple POST request in PHP to another web server by using a socket connection.
0 656 posted 8 years ago by apphp-snippets
With increasing of popularity of WordPress script, Gravatars have become a really quite popular. Now you may easy integrate them into your own script as they provide a very easy to use API.
0 269 posted 8 years ago by apphp-snippets
Usually when you're using different CSS files on your site, they might take a quite long to be loaded. Using this PHP code, you can compress them into a single file with no unnecessary white spaces or comments. Why we need to compress multiple CSS fi...
0 329 posted 8 years ago by apphp-snippets
This code allows to remove all duplicate elements from an array using PHP array_unique() function.
0 483 posted 8 years ago by apphp-snippets
This snippet allows you set a limitation for download rate of the file that visitors download from your site.
1 538 posted 8 years ago by apphp-snippets
This code shows how to parse XML file in easy way using PHP.
0 420 posted 8 years ago by apphp-snippets
This code allows to list the contents of any given directory.
1 387 posted 8 years ago by apphp-snippets
This code allows to pass filename in the $file_name variable and function will return file extension only.
0 406 posted 8 years ago by apphp-snippets
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 416 posted 8 years ago by apphp-snippets
You may retrieve all needed file path data using PHP's built-in function pathinfo. You don't need to create your own functions or use regular expressions to get this info. It was already been created for this purpose.
0 513 posted 8 years ago by apphp-snippets
Sometimes you need to generate passwords for customers automatically when a new account is created. This code allows you choose the desired length and strength for the password and it is very flexible.
0 277 posted 8 years ago by apphp-snippets
Encodes the given data with MIME base64. Base64-encoded data takes about 33% more space than the original data.
0 486 posted 8 years ago by apphp-snippets
This is a very common PHP question of HOW TO remove last character from string in PHP. Find below some ways how to delete last character from string in PHP.
0 694 posted 8 years ago by apphp-snippets
This function highlight_string() outputs or returns a syntax highlighted version of the given PHP code using the colors defined in the built-in syntax highlighter for PHP.
0 274 posted 8 years ago by apphp-snippets
The mail() function allows you to send emails directly from a script. Remember, that most of shared hosting providers require (for security reasons) to use the domain name of your hosting in "FROM" email, e.g. [email protected] for http://yourdomai...
1 401 posted 8 years ago by apphp-snippets
If you work with Twitter, you probably use a url shortener such as tinyurl.com or bit.ly to share/post your favorite blog posts or important messages with links on the network. This snippet take your url as a parameter and returns a short url.
0 420 posted 8 years ago by apphp-snippets
You may use this code to highlight specific words in your displaying search results.
3 417 posted 8 years ago by apphp-snippets
This code removes all special characters from the given URL and make it SEO friendly.
2 347 posted 8 years ago by apphp-snippets
These 2 techniques can be used for alternating row-colors in a table.
1 452 posted 8 years ago by apphp-snippets
Sometimes you have some information on your page and your visitors might want to copy it. The easiest way is to provide a mechanism that allows them to simply click a button to do so. You have to paste this code into the head of your web page:
0 399 posted 8 years ago by apphp-snippets
Allows to perform PHP redirection (must be placed before any browser output).
0 321 posted 8 years ago by apphp-snippets
This script informs your visitor that a given page may be reached only from the page that you specify. Paste this code before the ending <head> tag on the page:
0 422 posted 8 years ago by apphp-snippets
This example of code shows how to do a simple POST request in PHP to another web server by using a socket connection.
0 629 posted 8 years ago by apphp-snippets
Helps to find out browser version and type your website visitor is using.
0 416 posted 8 years ago by apphp-snippets
This code allows to get the IP address from which the user is viewing the current page.
0 506 posted 8 years ago by apphp-snippets
1 2 3 Next »