Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

About this user

James Prickitt http://www.precision-websites.com/

« Newer Snippets
Older Snippets »
2 total  XML / RSS feed 

CSS image floats no text wrap

Credit goes to:

http://ghettocooler.net/2005/11/13/image-floats-without-the-text-wrap/

.callout {
float:left;
width:275px;
}

.callout h3 {
width:115px;
height:65px;
float:left;
text-indent:-8008px;
background:transparent url(team-report.gif) no-repeat 0 0;
}

.callout * {
width:160px;
float:right;
}

.callout * * {
width:auto;
float:none;
}


Output all PHP variables

// This outputs PHP variables for debugging. I didn't create it, here is the original source. Thanks to the creator for writing it: kailashbadu at hotmail dot com

// http://us.php.net/get_defined_vars


<?php
  /**
   * @desc   works out the variables in the current scope(from where function was called).
   *         Returns an array with variable name as key and vaiable value as value
   * @param  $varList: variables returned by get_defined_vars() in desired scope.
   *         $excludeList: variables to be excluded from the list.
   * @return array
   */
  function getDefinedVars($varList, $excludeList)
  {
      $temp1 = array_values(array_diff(array_keys($varList), $excludeList));
      $temp2 = array();
      while (list($key, $value) = each($temp1)) {
          global $$value;
          $temp2[$value] = $$value;
      }
      return $temp2;
  }
 
  /**
   * @desc   holds the variable that are to be excluded from the list.
   *         Add or drop new elements as per your preference.
   * @var    array
   */
  $excludeList = array('GLOBALS', '_FILES', '_COOKIE', '_POST', '_GET', 'excludeList');
 
  //some dummy variables; add your own or include a file.
  $firstName = 'kailash';
  $lastName = 'Badu';
  $test = array('Pratistha', 'sanu', 'fuchhi');
 
  //get all variables defined in current scope
  $varList = get_defined_vars();
 
  //Time to call the function
  print "
";
  print_r(getDefinedVars($varList, $excludeList));
  print "
"; ?>
« Newer Snippets
Older Snippets »
2 total  XML / RSS feed