Archive

Posts Tagged ‘Miscellaneous’

usleep()

It delays execution in microseconds

Example

<?php
echo date(‘h:i:s’) . “<br />”;
usleep(20000000);
echo date(‘h:i:s’);
?>

Output

06:02:42
06:03:02

EmailFacebookLinkedInMySpaceDiggTumblrStumbleUponShare
Categories: PHP Tags: , , ,

unpack()

It unpacks data from binary string

Example

<?php
echo “<pre>”;
print_r(unpack(“C*”,”phpcode”));
?>

Output

Array
(
[1] => 112
[2] => 104
[3] => 112
[4] => 99
[5] => 111
[6] => 100
[7] => 101
)

EmailFacebookLinkedInMySpaceDiggTumblrStumbleUponShare
Categories: PHP Tags: , , ,

uniqid()

It generates a unique ID

Example

<?php
echo uniqid();
?>

Output

4fbcd679849c3

EmailFacebookLinkedInMySpaceDiggTumblrStumbleUponShare
Categories: PHP Tags: , , ,

time_sleep_until()

It makes the script sleep until the specified time

Example

<?php
time_sleep_until(time()+5);
?>

EmailFacebookLinkedInMySpaceDiggTumblrStumbleUponShare
Categories: PHP Tags: , , ,

time_nanosleep()

It delay for a number of seconds and nanoseconds

Example

<?php
echo time_nanosleep(0, 500000000)?”Slefpt for half second”:”No”;
?>

Output

Slefpt for half second

EmailFacebookLinkedInMySpaceDiggTumblrStumbleUponShare
Categories: PHP Tags: , , ,

sys_getloadavg()

It returns system load average

Example

<?php
echo “<pre>”;
print_r(sys_getloadavg());
?>

Output

Array
(
[0] => 0.1
[1] => 0.27
[2] => 0.37
)

EmailFacebookLinkedInMySpaceDiggTumblrStumbleUponShare
Categories: PHP Tags: , , ,

sleep()

It delays execution

Example

<?php
echo date(‘h:i:s’) . “<br />”;
sleep(10);
echo date(‘h:i:s’) . “<br />”;
?>

Output

05:38:00
05:38:10

EmailFacebookLinkedInMySpaceDiggTumblrStumbleUponShare
Categories: PHP Tags: , , ,

show_source()

Its an alias of highlight_file() and outputs a file with the PHP syntax highlighted

Example

<?php
echo show_source(“index.php”);
?>

EmailFacebookLinkedInMySpaceDiggTumblrStumbleUponShare
Categories: PHP Tags: , , ,

Switch to our mobile site