harunB10 harunB10 - 1 year ago 84
PHP Question

How to create integer out of array?

Is it possible to convert array values into one single integer. For example, I have array with numbers

$array = array(7,4,7,2);

Is it possible to get integer value 7472 from this array?

Answer Source

Simple use implode as

$array = array(7,4,7,2);
echo (int)implode("",$array);// 7472
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download