New Softabar

As of March 13, 2010 we have a new web site. Please go to www.softabar.com

We have also changed our business model. From now on our software is license under General Public License and so they are now Free Software. Free as in free speech, not as in free beer.

This old site is no longer updated but site is going to remain here. Products listed here also remain here and they can even be purchased but they will no longer be updated or supported.

 
 
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

SCLEC-NXT has been updated to version 2.4.0.

New version is available here.

 

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
(c) 2005-2008 Softabar. All rights reserved.
Joomla Templates by JoomlaShack Joomla Templates