Tutorialsplane

Codeigniter Number Helper


Codeigniter Number Helper – Codeigniter number helper provide various functions that are used to display the formats number in a bytes. $this->load->helper(‘number’);is used to load the helper. This contains formats numbers as bytes, based on size, and adds the appropriate suffix. Here in this tutorial, we are going to explain how to use this helper with the example.


Codeigniter number helper example

Now we will see how to load number helper in codeigniter and then use its function-

Load number helper

How to load number helper in codeingniter example:
 
$this->load->helper('number');

Available functions:-

Following functions are available in number helper.

Byte format

Syntax of byte format function

Syntax of byte format function is :-

byte_format($num[$precision = 1])

EXAMPLE

Here is simple example of number helper tags.

Number helper tags in codeigniter example:-

<h3>Number Helper Example</h3>
<?php echo byte_format(854);??> <br/>
<?php echo byte_format(4226);??> <br/>
<?php echo byte_format(54879); ??><br/>
<?php echo byte_format(123542);??> <br/>
<?php echo byte_format(6542315);??> <br/>
<?php echo byte_format(521365487952);??><br/> 
<?php echo byte_format(58754213654788956324);??>

The output of the above example will be something like this –

Models

Connect Database

Helpers

Libraries

Helper Reference

Library Reference

Database Reference