It can be used to change file ownership
Example
<?php
chown(“test.txt”, “phpcodez”);
?>
It can be used to change file ownership
Example
<?php
chown(“test.txt”, “phpcodez”);
?>
It can be used to change file permission
Example
<?php
chmod(“/var/www/test/”, 0777);
chmod(“/var/www/test/”, “u+rwx,go+rx”);
?>
It can be used to change file group
Example
<?php
$file = ‘test.txt’;
chgrp($file,”php”);
?>
It returns trailing name component of path
Example
<?php
echo basename(“/var/www/php”);
?>
Output
php
Example
<?php
function func($a, $b)
{
if ($a == $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
}
echo “<pre>”;
$array = array(1, 7, 5, 8, 4);
usort($array, “func”);
print_r($array);
?>
Output
Array
(
[0] => 1
[1] => 4
[2] => 5
[3] => 7
[4] => 8
)
Example
<?php
function func($a, $b)
{
if ($a == $b) {
return 0;
}
return ($a < $b) ? -1 : 1;
}
echo “<pre>”;
$array = array(1=>”PHP”, 7=>”ASP”, 5=>”JS”, 8=>”AS”, 4=>”JSP”);
uksort($array, “func”);
print_r($array);
?>
Output
Array
(
[1] => PHP
[4] => JSP
[5] => JS
[7] => ASP
[8] => AS
)
Example
<?php
echo “<pre>”;
$lan = array(“PHP”,”ASP”,”JSP”);
uasort($lan);
print_r($lan);
?>
Output
Array
(
[0] => PHP
[1] => ASP
[2] => JSP
)
Example
<?php
echo “<pre>”;
$lan = array(“PHP”,”JSP”,”ASP”);
sort($lan);
print_r($lan);
?>
Output
Array
(
[0] => ASP
[1] => JSP
[2] => PHP
)
Example
<?php
$lan = array(“PHP”,”JSP”,”ASP”);
echo sizeof($lan);
?>
Output
3
Example
<?php
echo “<pre>”;
$lan = array(“PHP”,”JSP”,”ASP”);
shuffle($lan);
print_r($lan);
?>
Output
Array
(
[0] => ASP
[1] => PHP
[2] => JSP
)