The IT Community
log in/create account

The free IT knowledge base with tips and tricks from the community

The IT Community

The free IT knowledge base with tips and tricks from the community

The 30 latest articles from our users:
  1. Get a list of all drivers from a SCCM driver package
  2. Check sitemap xml file for invalid links
  3. Change the URL of a website file
  4. Upgrade legendary gems in Diablo 3
  5. Complete the blood marsh bounty in Diablo 3
  6. Get white ascended items in Diablo 3
  7. Get a level 70 hellfire ring
  8. Turn off spell checker in Windows 8
  9. Redirect between www and non-www with apache and htaccess
  10. All quests in Reaper of Souls
  11. Recreate a auto increment column in mysql
  12. Disable Android app notifications
  13. Do the dragon shout on South Park The Stick of Truth
  14. HP Port Replicator previous uninstall not yet complete
  15. A quick tip for the catapult quest in Diablo 3
  16. Get the keywords of a site using php
  17. Disable the language settings in elgg
  18. Get the name of the current file with php
  19. Get rid of the libgcc error with MediaWiki
  20. Change the volume of a mp3 file
  21. Disable the server signature in Apache
  22. Silently launch a Windows process in the background
  23. Sleep in CMD
  24. Call the Device Manager in SCCM
  25. Change a quest in HearthStone
  26. Find people with the same interests on the internet
  27. CM Answers - A Questions and Answers Plugin for Wordpress
  28. Disable the Bing integration in Windows 8.1
  29. All quests in Hearthstone
  30. Disable all the mods in Elgg
Search The IT Community:

Fewer words bring better search results!

Follow The IT Community:
Follow us on Twitter , Tumblr
or on Facebook to recieve the latest updates.

Partner Links:


Same Interests

If you want to become a partner of The IT Community, please send an email to

One of the many articles by the community:

Get the name of the current file with php

If you have a website written in php and you want to get the name of the current page, it is actually very easy.

Just use

basename(preg_replace('/\.php$/', , __FILE__))

Let´s brake this down:


gives you the name of the current file including .php and the full path.

To get rid of the extension we use

(preg_replace('/\.php$/', , __FILE__)

which replaces the .php with nothing.

Now, to get rid of the full path, we use the php function basename.

If you - for example - want to replace the keywords meta tag with the name of the current page you can insert the following into your head section:

<meta name="keywords" content="<?php echo basename(preg_replace('/\.php$/', , __FILE__)) ?>" />

This is great if you want to create dynamically created sites.