<?php $myVariable1 = '2345'; $myVariable2 = 4433; $myVariable3 = 'test'; $myVariable4 = '1345.33'; function makeInteger($val){ return is_numeric($val) ? (int)$val : null; } for($i=1;$i<=4;$i++){ echo makeInteger(${"myVariable".$i}).PHP_EOL; }
You have javascript disabled. You will not be able to edit any code.