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
Functions 299 codes
Home
Php
Functions
1 @printf(pMaths
2 A Function Requiring Two Arguments
3 A function that calculates sales tax
4 A Function That Returns a Value
5 A function that takes a reference for an argument
6 A Function to Build Query Strings
7 A Function with an Optional Argument
8 A recursive function is a function that calls itself from within its own code
9 A Simple Anonymous Function
10 A Simple Hello World Script
11 A Simple Movie
12 A Simple User Function
13 Accessing a Global Variable from Within a Function
14 Accessing Function Parameters
15 Accessing function parameters without using the argument list
16 Add both name and address values into the email address
17 Add lines and spaces to textarea
18 Adding the pre and pre tags so the spaces display
19 Adding the session ID to the notes table
20 Advanced PEAR
21 All optional arguments
22 Alternate Row Colours
23 Alternating Row Colors
24 Another Alternate Row color
25 Another way to create a unique ID is to prepend the derived value with a string
26 Array get_extension_funcs ( string extension_name ) returns an array of the functions available inside that extension
27 Array get_loaded_extensions ( void ) takes no parameters and returns an array of the names of all extensions you have loa
28 Behavior of Files Included Using include
29 Bool function_exists ( string function_name ) returns true if that function is available for use
30 Bool is_callable ( mixed var [, bool check_syntax_only [, string &proper_name]] ) returns true if a function can be called
31 Buffering output
32 Build and then call a function
33 Call the function
34 Calling a Function Dynamically
35 Calling an Overridden Function
36 Calling Functions Dynamically
37 Calling the man Command
38 Calling Variable Functions
39 Capturing a return value
40 Change Background Color each day
41 Changing argument values
42 Changing the default file permissions
43 Check to see the maximum post value size
44 Checking for session hijacking
45 Code Block Containing Multiple print() Statements
46 Color Center
47 Color picker
48 Communicating within Apache
49 Comparing the output of md5 to that of sha1
50 Convert the newlines to br
51 Convert the string produced by serialize() back into an object with the unserialize() function
52 Correct escaping of special characters
53 Create a User Function
54 Create function from string
55 Creating a capitalize function with a default parameter $each
56 Creating an md5 signature
57 Creating and calling a function that accepts arguments
58 Creating Dynamic Functions
59 Creating Functions That Take a Variable Number of Arguments
60 Declaring a Function
61 Declaring a Function That Requires Arguments
62 Declaring a Function with Arguments
63 Declaring a Simple Function
64 Default Parameters
65 Define constant in a function
66 Define recursive function to delete directories
67 Define whether a variable is passed by value or reference
68 Defining and Calling a two-argument function
69 Defining functions before or after calling them
70 Demonstrating Some Type Specifiers
71 Display all available background colours
72 Displaying a real number in money format
73 Displaying long text with an ellipsis
74 Displaying signs with printf()
75 Displaying the same number in different formats
76 Displaying Times and Dates in Other Languages
77 Dynamically Creating Functions
78 Each line is converted into an array
79 Echo is more useful because you can pass it several parameters
80 Echo out html tags
81 Echo versus print
82 Embedded variables are handled when the string is created with single or double quotes
83 Encapsulating Complex Data Types
84 Enclosure html into a string and echo out
85 Encrypting and Sending Secure Emails Using SMIME
86 Escaping shell metacharacters
87 Escaping User Input with the escapeshellcmd() Function
88 Examining an Array with print_r()
89 Example
90 Execute a string as if it were PHP code using the eval( ) function
91 Executing df and displaying the results
92 Executing External Applications Using exec()
93 Extracting Values from an Array Using list()
94 Format an integer and a floating-point value with the printf() function
95 Format characters for pack( ) and unpack( )
96 Format strings for use in printf( )
97 Formatting a price with printf()
98 Formatting of Numeric Data
99 Func_num_args() and func_get_args()
100 Function Arguments
101 Function printing text on a Web Page
102 Function Recursion Demo
103 Function Requiring Two Arguments
104 Function return more than one value
105 Function uniqid() generates a 13-character unique identification number based on the current time
106 Function with an Optional Argument
107 Function with default parameters
108 Function with two parameters
109 Functions and References
110 Functions that return true or false
111 Generating a Flash movie
112 Generating a Unique Identifier
113 Generating fixed-width field data records
114 Generating Localized GMTUTC Time and Date Strings
115 Get individual information about the current PHP settings
116 Get information about PHP settings by ini_get() function
117 Get parameter count from func_num_args ()
118 Global key word in a function
119 Handling DST with zoneinfo
120 How arrays embedded in strings will be converted
121 If your low parameter (parameter one) is higher than your high parameter (parameter two), you get an array counting down,
122 Include_once and require_once will only include a file once
123 Include_once() function verifies whether or not the file has already been included
124 Including files relative to the current file
125 Including Other Files
126 Initializing an Array As a Range or Sequence of Values
127 Insert a unique ID into a form
128 Int connection_status ( void ) returns 0 if the connection is live
129 Int dl ( string extension_name ) loads an extension at runtime
130 Int ignore_user_abort ( [bool enable] ) carry on working after the user has cancelled her request
131 Int printf ( string format [, mixed argument [, mixed ]] ) is the standard C way to format text
132 Int sleep ( int seconds ) pauses execution for a set number of seconds, determined by the parameter you provide it
133 Interpolating array element values in double-quoted strings
134 Interpolating array element values with curly braces
135 JPEG Directory thumbnail system
136 Key-value array elements
137 Left-aligned by prepending a minus symbol (-) to the field width specifier
138 List($maths, $english, , $biology) = $scores
139 Mail() function mails information to a given recipient
140 Mail-javascript php
141 Making arguments be passed by reference
142 Math Function Library
143 Mcrypt_encrypt php
144 MD5 by way of the mhash extension
145 Md5 php
146 MD5 with the hash() function in PHP 5 1 2+
147 Mhash php
148 Mix the output of date( ) with a text string to get a natural-looking statement
149 Mix variable with string output
150 Mixed call_user_func ( function callback [, mixed param1 [, mixed ]] ) calls an existing PHP function
151 Multi Column Output
152 Multiple return statements in a function
153 Nested function
154 Nesting functions
155 Nice looking dir indexr
156 Nl2br() function converts all newline (n) characters to their HTML equivalent br
157 Output man page
158 Output string value
159 Output system information
160 Output value of a variable wit print function
161 Output_reset_rewrite_vars( )
162 Overriding the Function of a Base Class
163 Pad with leading zeroes
164 Padding Output with the Padding Specifier
165 Parsing a configuration file
166 Parsing commmand-line arguments
167 Pass an array as the second parameter to parse_str( ), and it will put the variables into there
168 Passing an Argument to a Function by Value
169 Passing Arguments and Returning Values by Reference
170 Passing By Reference
171 Passing Variables as a Reference to the Argument of a Function
172 Passthru() function works like exec(), except that the command output is automatically output
173 PEAR
174 Phpinfo function
175 PHPs basic md5() function
176 Pingserver php
177 Portscanner php
178 Preferred locale for Chinese
179 Preferred locale for German
180 Preferred locale for Russian
181 Print_r(,true ) passes its output back as its return value, and not print anything out
182 Printf and format
183 Printf and string format
184 Printf puts the numbers into the string
185 Printf() and sprintf() Formatting Types
186 Printf() and Type Specifiers
187 Printf() Type Specifiers
188 Printing a form
189 Quick PEAR
190 Random unique id
191 Range( ) function creates an array of numbers between a low value and a high value
192 Range( ) function has a third parameter that allows you specify a step amount in the range
193 Reading an environment variable, $_ENV[USER]
194 Reading another environment variable,$_ENV[HOME]
195 Reading Environment and Configuration Variables
196 Recursive Function Example
197 Recursive Functions
198 Register_shutdown_function and sleep
199 Require() operates like include(), including a template
200 Require_once() function ensures that the insertion file is included only once in your script
201 Retrieving a protected page with cURL
202 Return multiple values from a function
203 Return the function name from a function call or calculation
204 Returning a list an array from function
205 Returning a Value by Reference
206 Returning a value from a function
207 Returning an array from a function
208 Returning by Reference
209 Returning More Than One Value
210 Returning Values by Reference
211 Running a program with shell_exec()
212 Saving Arrays
213 Saving Objects
214 Send-email-multiple-recipients-2 php
215 Send-email-with-headers php
216 Sending a message with mail()
217 Sending Internet Mail
218 Sending Mail
219 Sending user-requested information
220 Send-mail-multiple-recipients php
221 Send-plaintext-email php
222 Sends a HTML mail from a given email address
223 Serialization
224 Serialize and unserialize array
225 Setlocale() Options
226 Setlocale(LC_MONETARY, en_DK)
227 Setlocale(LC_MONETARY, en_US)
228 Setting a default locale
229 Setting a default locale based on system environment
230 Setting an environment variable
231 Setting Environment and Configuration Variables
232 Sharing Variables Between Processes
233 Shmop Functions
234 SIMPLE Databse Driven Web Site
235 Storing and Retrieving Objects
236 String escapeshellcmd ( string command ) escapes special characters in shell commands
237 String exec ( string command [, array &output [, int &return_val]] ) runs an external program
238 String ini_get ( string varname ) reads a value from the php ini file without altering it
239 String ini_set ( string varname, string value ) sets system attributes
240 String Manipulation
241 String md5 ( string str [, bool raw_output] )
242 String md5 ( string str [, bool raw_output] ) produces a data checksum in exactly the same way as sha1( )
243 String nl2br ( string str ) inserts a HTML line break (br ) before all new line characters
244 String nl2br ( string string )
245 String sha1 ( string str [, bool raw_output] )
246 Stronger Encryption Algorithms
247 Symmetric Decryption
248 Testing for a Functions Existence
249 The printf function formats complex strings using a single expression
250 The protect() MD5 Form Fingerprint Generator
251 To report local time for any Germans
252 Transfer data from one server to another
253 URL Rewriting
254 Use printf to output float numbers
255 Use range( ) to create arrays of characters, like this
256 User-Defined Function to Determine a Leap Year
257 Using $argc and $argv in CLI PHP
258 Using a callback with ob_start()
259 Using a Function Call to Pass an Argument to a Function by Reference
260 Using a recursive function to sum an integer set
261 Using a variable function determined by some input variable
262 Using an array returned from a function
263 Using Arrays of Lambda Functions
264 Using base64_decode(), the User Data Is Readable
265 Using escapeshellarg()
266 Using exec() to Produce a Directory Listing
267 Using get_browser()
268 Using getenv()
269 Using include to Load Files in PHP
270 Using include() to Execute PHP and Assign the Return Value
271 Using include() Within a Loop
272 Using include_once to include a file
273 Using mail() to redirect user information
274 Using Mcrypt generic
275 Using nested functions
276 Using Optional Parameters
277 Using parentheses with these constructs
278 Using passthru() to Output Binary Data
279 Using printf() to Format a List of Product Prices
280 Using require to Load Files in PHP
281 Using the list() function
282 Using the PHP passthru() Function
283 Using the shell_exec() Function
284 Variable function example
285 Variable Function Names
286 Variable Parameter Counts
287 Variables Defined Outside Functions Are Inaccessible from Within a Function by Default
288 Void exit ( [mixed status] ) terminates execution of a script, and is an alias of the exit( ) function
289 Void exit ( [mixed status] ) terminates execution of the script
290 Void parse_str ( string str [, array &arr] ) take a query string and convert it to variables
291 Void passthru ( string command [, int &return_var] ) runs an external program
292 Void register_shutdown_function ( function callback[, mixed param [, mixed ]] ) registers with PHP a function to be run w
293 Void set_time_limit ( int seconds ) sets how long a script should be allowed to execute
294 Void usleep ( int microseconds ) pauses script execution
295 WDDX Functions in PHP
296 When you specify a color in HTML, you combine three hexadecimal numbers between 00 and FF
297 Working with printf()
298 Wrapping Text with wordwrap() and nl2br()
299 Zero-padding with printf()