You are here

function search_krumo_inspect in Search Krumo 7

Function that returns the variable name that is the input for sdpm().

Return value

string Either the real variable name or the default variable name $var.

1 call to search_krumo_inspect()
sdpm in ./search_krumo.module
A function that adds backtracing capability to Devels dpm().

File

./search_krumo.module, line 69
Code for the Search Krumo module.

Code

function search_krumo_inspect() {

  // Start a backtrace.
  $backtrace = debug_backtrace();

  // Continue on if we can read the the backtrace files.
  if (is_readable($backtrace[1]['file'])) {
    $src = file($backtrace[1]['file']);
    $line = $src[$backtrace[1]['line'] - 1];

    // Match the function call and the last closing bracket.
    preg_match('#sdpm\\((.*?)(,|\\))#', $line, $match);

    // If we have a match we return it.
    if (isset($match[1])) {
      return $match[1];
    }
    else {

      // Else we return the default variable name.
      return '$var';
    }
  }
  else {

    // Else we return the default variable name.
    return '$var';
  }
}