Mega Code Archive
Search
.Net
ASP .Net
ASP .Net Tutorial
C#
C# Book
C# by API
C# Tutorial
VB.Net
VB.Net by API
VB.Net Tutorial
Visual C++ .Net
VisualBasic Script
Java
Java
Java Book
Java by API
Java Tutorial
Script
Flash ActionScript
Flex
JavaScript DHTML
JavaScript Reference
JavaScript Tutorial
Database
MSSQL
MSSQL Tutorial
MySQL
MySQL Tutorial
Oracle PLSQL
Oracle PLSQL Tutorial
PostgreSQL
Languages
Android
C
C Tutorial
C++
C++ Tutorial
Delphi
Perl
PHP
Python
Python Tutorial
Ruby
Silverlight
Office
MSOfficeExcel 2007 Tutorial
MSOfficePowerPoint 2007 Tutorial
MSOfficeWord 2007 Tutorial
Data
XML
XML Tutorial
Php
Code Snippets 155 codes
Home
Php
Code Snippets
1 A clock that updates
2 A daily MySQL row displayed
3 A Do While loop example in PHP
4 A greeting based upon the time of day
5 A nice graph effect
6 A resizing example that keeps the aspect ratio of the image intact
7 A simple class
8 A while loop example in PHP
9 Add data to a MySQL database
10 Add zeroes to the front of a number
11 Another resizing an image example
12 Atomic time
13 Backup a folder to a zip file
14 Basic currency conversion
15 Bubblesort routine
16 Calculate VAT on a price and round to two decimal places
17 Check a file exists
18 Check if an image exists using GD
19 Check number of characters in a range
20 Check that characters in a variable are alpha numeric using ereg
21 Check whether the GD library exists or is installed
22 Connect to a MySQL database
23 Convert links into clickable hyperlinks
24 Cool GD effect
25 Count and display the number of rows in a mysql database table
26 Count characters in a sentence
27 Count number of words in a text string
28 Count the number of lines in a text file
29 Count the number of rows ina MySQL database
30 Count words in a sentence
31 Create a database
32 Create a date with mktime
33 Create a MySQL database from PHP
34 Create a random password
35 Creating a table in a MySQL database
36 Date and time example
37 Decimal to binary conversion
38 Decimal to hexadecimal conversion
39 Decimal to octal conversion
40 Degrees Radians conversions
41 Delete data from a MySQL database
42 DIsplay the content type of a file with PHP and cURL
43 Display a random entry from aMySQL database
44 Display A to Z links on your site
45 Display all links on a web page
46 Display an Access database using PHP and ODBC
47 Display html source with line numbers
48 Display latest news from Slashdot
49 Display meta tags from another site
50 Display MySQL database rows alphabetically
51 Display mysql server information
52 Display rows from only a certain category of a MySQL database
53 Display stock quotes from a CSV file, in this case Microsoft
54 Display the date a page last modified
55 Display the date a page was last accessed
56 Display the dimensions of an image using the GD library
57 Display the latest news from the register on your site
58 Display the time
59 Display users processor information
60 Display when a page was last modified on your site
61 Display width and height of image
62 Display x amount of links from a MySQL database
63 Displays all files in the directory that the script resides
64 Displays lots of server information
65 Displays month, day and year
66 Displays the mysql version in use
67 Displays the type of image
68 Download a web page to a file using cURL
69 Email verify function
70 Encrypt a password
71 Extract a zip file to a folder
72 File exists with PHP and Java
73 File size function
74 Find a pattern in a text file
75 Find a string in another
76 Find and replace words in a text string using str_replace
77 For loop syntax in PHP
78 Free disk space
79 Function sorts an array in the reverse order
80 Generate a random password
81 Generate random letters
82 Generates a random string from an array of characters
83 Get current url using PHP_SELF
84 Get the connection time with PHP and cURL
85 Get the IP address corresponding to a given Internet host name
86 Get users IP address
87 Gethostbyaddr function returns the name of the host specified by
88 Gethostbyname function returns the IP address of the host specified by its name
89 Getprotobyname function returns the number associated with a protocol
90 Gets the Internet host name corresponding to a given IP address
91 Getservbyport function returns the name of the service that uses a specified port
92 GIF creation with PHP
93 Grab a web page with cURL
94 Hexadecimal to decimal conversion
95 How to display stock quotes on your website using Yahoo quotes
96 HTML special characters
97 Is a number odd or even
98 Java version with php
99 Latest news from Yahoo news
100 Latest stock market information
101 List all databases on a server
102 List all files in a directory and place them in a select menu
103 List all your MySql databases
104 Lookup the symbol for a company
105 Lottery number generator
106 Mozilla or Internet explorer
107 Number of days between now and a day in the future
108 Open a zip file and display file information
109 Page load time
110 Page redirect
111 PHP and cURL example
112 Php and java example
113 Populate a select menu from a MySQL database
114 Random password generator
115 Random title
116 Reading RSS feeds with PEAR xml_rss package
117 Remove all characters except letters and numbers from a string
118 Remove whitespace from a text string using the PHP trim function
119 Requires a file called counter1.dat in the same folder as the script
120 Same as before but the user chooses the quotes they wish to see
121 Send email using the PHP mail() function
122 Shorten a text string
123 Shows the value of PI
124 Simple quote of the month
125 Size of a webpage with PHP and cURL
126 Some date and time examples
127 Spam bots love looking for email addresses, give them a helping hand
128 Split a file into path info
129 Splitting a string
130 Status code of a web pagewith PHP and cURL
131 System uptime using php_w32api.dll functions
132 This backups index.php to a gzip file
133 This displays all tables in a MySQL database, enter your own database
134 This example checks whether a link is valid or not
135 This example shows how to search and replace on a string
136 This example shows how you can get the length of a string , this uses
137 This example shows some simple browser detection
138 This example uses an array to store images and then produces a random
139 This example will display a different background color for each day of the week
140 This function allows you to input your image , the percentage you wish
141 This is a currency convertor which allows a user to get the latest currency
142 This is a simple email form example
143 This is a simpler version of our metatag generator and only generates
144 This is an If Else statement example
145 This is the next step in the directory file viewer , allowing your users to
146 This shows how to generate random numbers
147 This shows how to use the trim function to remove white spaces
148 This uses the get_meta_tags function to display the meta tags of a given
149 Time to load page example
150 Use ereg to check that characters in a variable only contain letters
151 Validate an email address using regular expressions
152 Verify using ereg that characters in a variable only contain numbers
153 Visitor information
154 Word wrap
155 Write data to a text file