My apologies if the title isn't clear, but I find this difficult to describe. Basically, I have a function that looks for an instance of a class (the school kind) given a class ID number and a date. The function can also create a new class instance if desired.

```
function get_class_instance($class_id, $date, $create)

```

Inside the function is a database select on the **class\_instances** table using the **class\_id** and **date** as arguments. If a matching **class\_instance** is found, its ID is returned. If none is found, there's a conditional for the **create** argument. If it's true, a new **class\_instance** is created using a database insert and its ID is returned. If false, nothing is changed in the database and **false** is returned.

I'm still a beginner with PHP and coding generally, so I'm thinking there is probably a better way. The issue is that when calling the function, it might not be clear to someone why there is a boolean being passed.

```
$original_cinstance_id = get_class_instance($original_class_id, $original_date, 1);

```