Tag Archives: Functions

pathinfo

It returns information about a file path

Example

<?php
echo "<pre>";
print_r(pathinfo("test.ini"));
?>

Output

Array
(
[dirname] => .
[basename] => test.ini
[extension] => ini
[filename] => test
)

 

 

parse_ini_string

It parse a configuration string

Example

<?php

echo “<pre>”;

print_r(parse_ini_string(file_get_contents(“test.ini”)));

?>

Output

Array
(
[me] => phpcodez
[first] => http://www.phpcodez.com
)


“test.ini” file content

[names]

me = phpcodez


[urls]

first = “http://www.phpcodez.com”

parse_ini_file

It parses a configuration file

Example

<?php

echo “<pre>”;

print_r(parse_ini_file(“test.ini”));

?>

Output

Array
(
[me] => phpcodez
[first] => http://www.phpcodez.com
)


“test.ini” file content

[names]

me = phpcodez


[urls]

first = “http://www.phpcodez.com”

move_uploaded_file

It moves an uploaded file to a new location. It is used to validate whether the contents of $_FILES[‘name’][‘tmp_name’] have really been uploaded via HTTP, and also save the contents into another folder.

Example

<?php
 move_uploaded_file($tmp_name, $_FILES["file"]["name"]) or die("Failed");
?>

lstat

It returns information about a file or symbolic link

Example

<?php

echo “<pre>”;

symlink(‘test.php’, ‘test’);

print_r(lstat(‘test’));

?>

Output

Array
(
[0] => 2049
[1] => 673770
[2] => 41471
[3] => 1
[4] => 33
[5] => 33
[6] => 0
[7] => 8
[8] => 1336807250
[9] => 1336807250
[10] => 1336807250
[11] => 4096
[12] => 0
[dev] => 2049
[ino] => 673770
[mode] => 41471
[nlink] => 1
[uid] => 33
[gid] => 33
[rdev] => 0
[size] => 8
[atime] => 1336807250
[mtime] => 1336807250
[ctime] => 1336807250
[blksize] => 4096
[blocks] => 0
)