# codeigniter round off function

To round off a number in CodeIgniter, you can use the `round()`

function provided by PHP, as CodeIgniter is built on top of PHP. The `round()`

function allows you to round a number to a specified number of decimal places. Here are the steps to use the `round()`

function in CodeIgniter:

**Load the helper**: First, you need to load the helper that contains the`round()`

function. In CodeIgniter, you can load a helper using the`helper()`

function. For example, to load the`number_helper`

helper that contains the`round()`

function, you can use the following code:

```
$this->load->helper('number');
```

**Use the round() function**: Once the helper is loaded, you can use the`round()`

function to round off a number. The`round()`

function takes two parameters: the number you want to round and the number of decimal places to round to. Here's an example of how to use the`round()`

function to round off a number to 2 decimal places:

```
$number = 3.14159;
$rounded = round($number, 2);
```

In this example, the variable `$number`

contains the number 3.14159, and the variable `$rounded`

will contain the rounded value, which will be 3.14.

That's it! You have successfully used the `round()`

function in CodeIgniter to round off a number to a specified number of decimal places. Remember to load the helper that contains the `round()`

function before using it.