Social Bookmark

Add to: Mr. Wong Add to: Power-Oldie Add to: Linkarena Add to: Digg Add to: Del.icoi.us Add to: Reddit Add to: Jumptags Add to: Upchuckr Add to: Simpy Add to: StumbleUpon Add to: Slashdot Add to: Netscape Add to: Furl Add to: Yahoo Add to: Blogmarks Add to: Diigo Add to: Technorati Add to: Newsvine Add to: Blinkbits Add to: Ma.Gnolia Add to: Smarking Add to: Netvouz Add to: Folkd Add to: Spurl Add to: Google Add to: Blinklist Information
Social Bookmarking
 
PHP function to parse command line options PDF Print E-mail
Thursday, 26 October 2006
Simple function to parse command line options.

Input array is command line arguments and function returns associative array
of command line options.


function parseOptions($array)
{
  //parse command line options into associative
  //array so that each option that starts with
  //'-' is name and the next item is array of values
  //
  
  $len=sizeof($array);
  $currentName="";
  $options=array();
  for ($i = 1; $i < $len; $i++) {
    $name=$array[$i];
    if(strpos($name,"-")===0)
    {
      //is option
      $name=str_replace("-","",$name);      
      $currentName=$name;
      if($options[$currentName]==NULL)
      {
        $options[$currentName]=array();          
      }
    }
    else
    {
      $values=$options[$currentName];
      array_push($values,$name);    
      
      $options[$currentName]=$values;
        
    }
  }
  return $options;
}
Last Updated ( Friday, 01 February 2008 )
 
Next >

Newsflash

Carbon counter added to the website.

Counter uses publicly available data to calculate electricity usage of both client and server and the result is carbon footprint of the visit.

 
Would you participate in Open Product Development?
 
Open Product Development

Open Product Development is a new method to do commercial product development. You, as a product user, can participate in designing and deciding product features.

You can suggest product features which to include in the product and decide what to implement and how to prioritize features.

You can participate using forum, polls and directly contacting us. We will update product development in the web site including what features we are implementing and so on.

While the product is in development, price is very low and all who have purchased the product will get final version without extra cost.

 
(c) 2005-2008 Softabar. All rights reserved.
Joomla Templates by JoomlaShack Joomla Templates