WHAT A LAMP Rotating Header Image

Posts Tagged ‘function’

Why you want your own WordPress theme

To have a very sharp Blog, you need your own WordPress theme. There are five reasons official WordPress said you need your own WordPress theme.
* To create your own unique WordPress site look
* To take advantage of templates, template tags, and the WordPress Loop to generate different web page results and looks.
* To provide [...]

JavaScript Classes Comparison

There are more and more JavaScript Classes in front of programers. To choose one of the suitable is very important.
Let me list some of them here: jQuery, Ext, MooTools, Prototype, YUI.
Remy Sharp has gone through the jQuery and Prototype frameworks, which are probably the two closest to each other, and has done a side by [...]

strpos()

Using the strpos() function
The strpos() function is used to search for a string or character within a string.
If a match is found in the string, this function will return the position of the first match. If no match is found, it will return FALSE.
Let’s see if we can find the string “world” in our string:
<?php
echo [...]

strlen()

Using the strlen() function
The strlen() function is used to find the length of a string.
Let’s find the length of our string “Hello world!”:
<?php
echo strlen("Hello world!");
?>
The output of the code above will be:

12
The length of a string is often used in loops or other functions, when it is important to know when the string ends. (i.e. [...]

Date function in JavaScript

Return today’s date and time
How to use the Date() method to get today’s date.
The following code line defines a Date object called myDate:

var myDate=new Date()

Note: The Date object will automatically hold the current date and time as its initial value!
In the example below we set a Date object to a specific date (14th January 2010):

var [...]

Make a Function

A function is a named group of JavaScript statements that you can declare once, near the top of your script, and call over and over again.
Declaring a function

function name ([parameter] [, parameter] [..., paramenter]){
statements
return value
}
Call a function
alert(”Total purchases come to ” + calculateTotal (10, 19.85))
Returning a value from a function

function calculateTotal (numberOrdered, itemPrice){
var totalPrice = [...]