Skip to content

Instantly share code, notes, and snippets.

View patricklewis's full-sized avatar

Patrick Lewis patricklewis

View GitHub Profile

Keybase proof

I hereby claim:

  • I am patricklewis on github.
  • I am patricklewis (https://keybase.io/patricklewis) on keybase.
  • I have a public key whose fingerprint is B72F 2B4C 80B3 FBD1 ED5A DEE0 610D 2574 C641 8AB6

To claim this, I am signing this object:

<?php
function get_top_directory()
{
# get directory structure eg "/music/graduate/concerts"
$directoryPath = dirname($_SERVER['PHP_SELF']);
# put each directory into an array
$directoryArray = explode('/', $directoryPath);
# get the top level directory
$topDirectory = max($directoryArray);