Question: I was reading php functions and I came across [symlink](http://www.php.net/manual/en/function.symlink.php) but I really couldnt grab it specially its usage in real world application developement. Can anybody please explain me with real world example?

Thanks

Answer: 
An administrator may create symlinks to arrange storage without messing up filesystems; e.g. a web mirror may have thousands of sites hosted, and dozens of disks mounted:

```
/mnt/disk1/
/mnt/disk2/
...

```

and want to store data in their `/var/www/htdocs/` without users caring about which disk holds their data.

```
/var/www/htdocs/debian -> /mnt/disk1/debian
/var/www/htdocs/ubuntu -> /mnt/disk2/ubuntu
/var/www/htdocs/centos -> /mnt/disk9/centos

```

Second, you may have a 'latest upload'; your users are uploading photos, or software packages, and you want `http://example.com/HOT_STUFF` to always be the most recent uploaded photo. You could set the `symlink($new_upload, $HOT_STUFF);` and users will never need more than the one URL to see the newest thing.

Third, Debian and Ubuntu use the [update-alternatives](http://linux.die.net/man/8/update-alternatives) mechanism to allow multiple versions of a tool to be installed at once and yet still allow the administrator to say which one is the default. e.g.,

```
$ ls -l /usr/bin/vi
lrwxrwxrwx 1 root root 20 2011-01-11 01:07 /usr/bin/vi -> /etc/alternatives/vi
$ ls -l /etc/alternatives/vi
lrwxrwxrwx 1 root root 18 2011-01-11 01:07 /etc/alternatives/vi -> /usr/bin/vim.basic
$ ls -l /usr/bin/vim.basic
-rwxr-xr-x 1 root root 1866904 2010-09-28 04:06 /usr/bin/vim.basic

```

It's a little circuitous, but the configuration is maintained in a per-system `/etc/` directory, and the usual `/usr/bin/vi` path will execute something that is very much like `vi`, when there are many choices available (nvi, elvis, vim, AT&T vi, etc.)
Symlinks are something that is used on the host OS, not so much by PHP itself.  

It creates a shortcut to a file. It can be useful to request a much used file with a long path, by creating a symlink in the `public_html` folder to the long path you can include it without using the full path. 

<http://en.wikipedia.org/wiki/Symbolic_link>

//edit:  

This is better then just copying the file because you actually use the original file, so if the original changes the symlink will always point to the new file, so it is not a copy!