# Little 'function($vars=default)' problem

**URL:** https://forum.kirupa.com/t/little-function-vars-default-problem/160358
**Category:** Uncategorized
**Created:** [August 25, 2005, 12:11pm UTC](https://forum.kirupa.com/t/little-function-vars-default-problem/160358 "2005-08-25T12:11:02Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mlk](https://avatars.discourse-cdn.com/v4/letter/m/e56c9b/32.png) [@mlk](https://forum.kirupa.com/u/mlk)
#### Post date: [August 25, 2005, 12:11pm UTC](https://forum.kirupa.com/t/little-function-vars-default-problem/160358/1 "2005-08-25T12:11:02Z")

</div>

Hi there ho there, this is probably going to be an easy one for you scripters.

I’m using functions in my pages and some of them have default values. However when I call the function (filling certain values but not others), php returns an error (saying it encountered unexpected ‘,’ or something).

This should be easier to understand:

```php

function anything($a,$b = 2,$c = 3, $d = 4){
 return ($a + $b + $c + $d);
}
//returns 10
echo anything(1);

//returns 16 
echo anything(1,3,5,7);

//returns a friggin error
echo anything(1,,,7);

```

How can I tell PHP that I want these two values to be the default ones declared in the function ?

cheers

matt
