Jump to content

[SOLVED] $_SERVER echo just the filename?


All4172

Recommended Posts

<?php


// get_file_name() Function
function get_file_name($string) {
  $str_array = explode("/", $string);
  $token = count($str_array) - 1;
  $file = explode("?", $str_array[$token]);
  return $file[0];
}

// Usage:
echo get_file_name($_SERVER['PHP_SELF']);


?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.