title: How do i set an optional parameter in PHP after the first optional parameter
body: <p>I'm fairly new to php and I am trying to figure how do I set an optional parameter after the first optional parameter?</p>
  
  <p>For example I have the following code:</p>
  
  <pre><code>function testParam($fruit, $veg='pota',$test='default test'){
  echo '&lt;br&gt;$fruit = '.$fruit;
  echo '&lt;br&gt;$veg = '.$veg;
  echo '&lt;br&gt;Test = '.$test;
  }
  </code></pre>
  
  <p>If i make the following calls:</p>
  
  <pre><code>echo 'with all parama';
  testParam('apple','carrot','some string');
  //we get:
  //with all parama
  //$fruit = apple
  //$veg = carrot
  //Test = some string
  
  echo '&lt;hr&gt; missing veg';
  testParam('apple','','something');
  //we get:
  //missing veg
  //$fruit = apple
  //$veg = 
  //Test = something
  
  echo '&lt;hr&gt; This wont work';
  testParam('apple',,'i am set');
  </code></pre>
  
  <p>I want to try make a call so that in the last example I show 'pota' as the default $veg parameter but pass into $test 'i am set'.</p>
  
  <p>I guess I can pass 0 into $veg then branch it in the code to say if $veg =0 then use 'pota' but just wondered if there's some other syntax  as i cant find anything in php.net about it.</p>