alphainventions.com

This is great site. Site will make me crazy.

I posted my link in this site and got huge traffic within an Hour. That’s very cool for blog owner or site owner who wants traffic on their site.

This Site is developed by Cheru Jackson. It is quite a different from normal site, I never seen this type of site on internet.

Thanks Cheru Jackson, for your creativity and developing a unique site. Hurrah…..

Blog

Click Here to See the site
http://Alphainventions.com

ucfirst


ucfirst :: (PHP 4, PHP 5)
     
 
ucfirst — Make a string’s first character uppercase
 
     
  Description  
     
 
string ucfirst ( string $str )

Returns a string with the first character of str capitalized, if that character is alphabetic.

Note that ‘alphabetic’ is determined by the current locale. For instance, in the default “C” locale characters such as umlaut-a (ä) will not be converted.

 
     
 
php quotes:
$foo = ‘hello world!’;
$foo = ucfirst($foo); // Hello world!

$bar = ‘HELLO WORLD!’;
$bar = ucfirst($bar); // HELLO WORLD!
$bar = ucfirst(strtolower($bar)); // Hello world!

:end quotes

 

end

end (PHP 4, PHP 5)
end — Set the internal pointer of an array to its last element

Description
mixed end ( array &$array )
end() advances array’s internal pointer to the last element, and returns its value.

$fruits = array(’apple’, ‘banana’, ‘cranberry’);
echo end($fruits); // cranberry

empty

empty (PHP 4, PHP 5)
empty — Determine whether a variable is empty

Description
bool empty ( mixed $var )
Determine whether a variable is considered to be empty.
$var = 0;

// Evaluates to true because $var is empty
if (empty($var)) {
echo ‘$var is either 0, empty, or not set at all’;
}

// Evaluates as true because $var is set
if (isset($var)) {
echo ‘$var is set even though it is empty’;
}

count_chars

count_chars (PHP 4, PHP 5)
count_chars — Return information about characters used in a string

Description
mixed count_chars ( string $string [, int $mode] )
Counts the number of occurrences of every byte-value (0..255) in string and returns it in various ways.
$data = “Two Ts and one F.”;

foreach (count_chars($data, 1) as $i => $val) {
echo “There were $val instance(s) of “” , chr($i) , “” in the string.n”;
}
The above example will output:

There were 4 instance(s) of ” ” in the string.
There were 1 instance(s) of “.” in the string.

chop

chop (PHP 4, PHP 5)
chop — Alias of rtrim()

Description
This function is an alias of: rtrim().
Notes
Note: chop() is different than the Perl chop() function, which removes the last character in the string.

rtrim

rtrim (PHP 4, PHP 5)
rtrim — Strip whitespace (or other characters) from the end of a string

Description
string rtrim ( string $str [, string $charlist] )
This function returns a string with whitespace stripped from the end of str.
$text = “ttThese are a few words … “;
$binary = “x09Example stringx0A”;
$hello = “Hello World”;
var_dump($text, $binary, $hello);

print “n”;

$trimmed = rtrim($text);
var_dump($trimmed);
$trimmed = rtrim($text, ” t.”);
var_dump($trimmed);
$trimmed = rtrim($hello, “Hdle”);
var_dump($trimmed);
// trim the ASCII control characters at the end of $binary
// (from 0 to 31 inclusive)
$clean = rtrim($binary, “x00..x1F”);
var_dump($clean);

ltrim

ltrim (PHP 4, PHP 5)
ltrim — Strip whitespace (or other characters) from the beginning of a string

Description
string ltrim ( string $str [, string $charlist] )
Strip whitespace (or other characters) from the beginning of a string.
$text = “ttThese are a few words … “;
$binary = “x09Example stringx0A”;
$hello = “Hello World”;
var_dump($text, $binary, $hello);

print “n”;

$trimmed = ltrim($text);
var_dump($trimmed);

$trimmed = ltrim($text, ” t.”);
var_dump($trimmed);

$trimmed = ltrim($hello, “Hdle”);
var_dump($trimmed);

array_sum

array_sum (PHP 4 >= 4.0.4, PHP 5)
array_sum — Calculate the sum of values in an array

Description
number array_sum ( array $array )
array_sum() returns the sum of values in an array as an integer or float.
$a = array(2, 4, 6, 8);
echo “sum(a) = ” . array_sum($a) . “n”;

$b = array(”a” => 1.2, “b” => 2.3, “c” => 3.4);
echo “sum(b) = ” . array_sum($b) . “n”;

The above example will output:
sum(a) = 20
sum(b) = 6.9

chown

chown (PHP 4, PHP 5)
chown — Changes file owner

Description
bool chown ( string $filename, mixed $user )
Attempts to change the owner of the file filename to user user. Only the superuser may change the owner of a file.
Notes
Note: This function will not work on remote files as the file to be examined must be accessible via the servers filesystem.
Note: When safe mode is enabled, PHP checks whether the files or directories you are about to operate on have the same UID (owner) as the script that is being executed.

htmlspecialchars_decode

htmlspecialchars_decode

(PHP 5 >= 5.1.0)

htmlspecialchars_decode — Convert special HTML entities back to characters

Description
string htmlspecialchars_decode ( string $string [, int $quote_style= ENT_COMPAT ] )

This function is the opposite of htmlspecialchars(). It converts special HTML entities back to characters.

The converted entities are: &, " (when ENT_NOQUOTES is not set), ' (when ENT_QUOTES is set), < and >.

strtolower

strtolower

(PHP 4, PHP 5)

strtolower — Make a string lowercase

Description
string strtolower ( string $str )

Returns string with all alphabetic characters converted to lowercase.

Note that ‘alphabetic’ is determined by the current locale. This means that in i.e. the default “C” locale, characters such as umlaut-A (Ä) will not be converted.

html_entity_decode

html_entity_decode

(PHP 4 >= 4.3.0, PHP 5)

html_entity_decode — Convert all HTML entities to their applicable characters
Description
string html_entity_decode ( string $string [, int $quote_style= ENT_COMPAT [, string $charset ]] )

html_entity_decode() is the opposite of htmlentities() in that it converts all HTML entities to their applicable characters from string .

stristr

stristr

(PHP 4, PHP 5)

stristr — Case-insensitive strstr()

Description
string stristr ( string $haystack , mixed $needle [, bool $before_needle= false ] )

Returns all of haystack from the first occurrence of needle to the end.

array_splice

array_splice (PHP 4, PHP 5)
array_splice — Remove a portion of the array and replace it with something else

Description
array array_splice ( array &$input, int $offset [, int $length [, array $replacement]] )

array_splice() removes the elements designated by offset and length from the input array, and replaces them with the elements of the replacement array, if supplied. It returns an array containing the extracted elements. Note that numeric keys in input are not preserved.
If offset is positive then the start of removed portion is at that offset from the beginning of the input array. If offset is negative then it starts that far from the end of the input array.

If length is omitted, removes everything from offset to the end of the array. If length is specified and is positive, then that many elements will be removed. If length is specified and is negative then the end of the removed portion will be that many elements from the end of the array. Tip: to remove everything from offset to the end of the array when replacement is also specified, use count($input) for length.

If replacement array is specified, then the removed elements are replaced with elements from this array. If offset and length are such that nothing is removed, then the elements from the replacement array are inserted in the place specified by the offset. Note that keys in replacement array are not preserved. If replacement is just one element it is not necessary to put array() around it, unless the element is an array itself.

The following statements change the values of $input the same way:
Table 21. array_splice() equivalents
array_push($input, $x, $y) array_splice($input, count($input), 0, array($x, $y))
array_pop($input) array_splice($input, -1)
array_shift($input) array_splice($input, 0, 1)
array_unshift($input, $x, $y) array_splice($input, 0, 0, array($x, $y))
$input[$x] = $y // for arrays where key equals offset array_splice($input, $x, 1, $y)

Returns the array consisting of removed elements.
$input = array(”red”, “green”, “blue”, “yellow”);
array_splice($input, 2);
// $input is now array(”red”, “green”)

$input = array(”red”, “green”, “blue”, “yellow”);
array_splice($input, 1, -1);
// $input is now array(”red”, “yellow”)

$input = array(”red”, “green”, “blue”, “yellow”);
array_splice($input, 1, count($input), “orange”);
// $input is now array(”red”, “orange”)

$input = array(”red”, “green”, “blue”, “yellow”);
array_splice($input, -1, 1, array(”black”, “maroon”));
// $input is now array(”red”, “green”,
// “blue”, “black”, “maroon”)

$input = array(”red”, “green”, “blue”, “yellow”);
array_splice($input, 3, 0, “purple”);
// $input is now array(”red”, “green”,
// “blue”, “purple”, “yellow”);

chroot

chroot (PHP 4 >= 4.0.5, PHP 5)
chroot — Change the root directory

Description
bool chroot ( string $directory )
Changes the root directory of the current process to directory.
This function is only available if your system supports it and you’re using the CLI, CGI or Embed SAPI. Also, this function requires root privileges.

file

file (PHP 4, PHP 5)
file — Reads entire file into an array

Description
array file ( string $filename [, int $flags [, resource $context]] )
Reads an entire file into an array.

Note: You can use file_get_contents() to return the contents of a file as a string.
// Get a file into an array. In this example we’ll go through HTTP to get
// the HTML source of a URL.
$lines = file(’http://www.prafulkr.wordpress.com.com/’);
// Loop through our array, show HTML source as HTML source; and line numbers too.
foreach ($lines as $line_num => $line) {
echo “Line #{$line_num} : ” . htmlspecialchars($line) . “
n”;
}

// example, let’s get a web page into a string. See also file_get_contents().
$html = implode(”, file(’http://www.prafulkr.wordpress.com.com/’));

fopen

fopen (PHP 4, PHP 5)
fopen — Opens file or URL

Description
resource fopen ( string $filename, string $mode [, bool $use_include_path [, resource $context]] )
fopen() binds a named resource, specified by filename, to a stream.
$handle = fopen(”c:abc.txt”, “r”);

Table 93. A list of possible modes for fopen() using mode

mode Description
‘r’ Open for reading only; place the file pointer at the beginning of the file.
‘r+’ Open for reading and writing; place the file pointer at the beginning of the file.
‘w’ Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
‘w+’ Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
‘a’ Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
‘a+’ Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
‘x’ Create and open for writing only; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call.
‘x+’ Create and open for reading and writing; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call.

Note: Different operating system families have different line-ending conventions. When you write a text file and want to insert a line break, you need to use the correct line-ending character(s) for your operating system. Unix based systems use n as the line ending character, Windows based systems use rn as the line ending characters and Macintosh based systems use r as the line ending character.
If you use the wrong line ending characters when writing your files, you might find that other applications that open those files will “look funny”.
Windows offers a text-mode translation flag (’t’) which will transparently translate n to rn when working with the file. In contrast, you can also use ‘b’ to force binary mode, which will not translate your data. To use these flags, specify either ‘b’ or ‘t’ as the last character of the mode parameter.
The default translation mode depends on the SAPI and version of PHP that you are using, so you are encouraged to always specify the appropriate flag for portability reasons. You should use the ‘t’ mode if you are working with plain-text files and you use n to delimit your line endings in your script, but expect your files to be readable with applications such as notepad. You should use the ‘b’ in all other cases.
If you do not specify the ‘b’ flag when working with binary files, you may experience strange problems with your data, including broken image files and strange problems with rn characters.
Note: For portability, it is strongly recommended that you always use the ‘b’ flag when opening files with fopen().
Note: Again, for portability, it is also strongly recommended that you re-write code that uses or relies upon the ‘t’ mode so that it uses the correct line endings and ‘b’ mode instead.

copy

copy (PHP 4, PHP 5)
copy — Copies file

Description
bool copy ( string $source, string $dest [, resource $context] )
Makes a copy of the file source to dest.
If you wish to move a file, use the rename() function.
$file = ‘example.txt’;
$newfile = ‘example.txt.bak’;

if (!copy($file, $newfile)) {
echo “failed to copy $file…n”;
}

chunk_split

chunk_split (PHP 4, PHP 5)
chunk_split — Split a string into smaller chunks

Description
string chunk_split ( string $body [, int $chunklen [, string $end]] )
Can be used to split a string into smaller chunks which is useful for e.g. converting base64_encode() output to match RFC 2045 semantics. It inserts end every chunklen characters.