从价格中删除期间

I'm using laravel to do my coding. Now I've save my price as this 123.45 and when I echo it out I get the same thing, which is correct and I want it to be saved like that in my database. The problem I have is that in order for me to be able to make a person pay a specific amount I need to remove the period so that it will look like this 12345.

I don't know if I'm not searching properly but I haven't been able to find a solution.

I am not sure but if your concern is just to remove a period from a decimal number you can try PHP's function str_replace():

$x = 245.25;
$x = str_replace('.', '', $x);
echo $x;

// output
24525

This will provide all the numbers removing the decimal point.

You can use the php round() function :

echo round(123.45, 0); // 123

echo round(123.55, 0); // 124

if not what you want you can use @Shiv solution

@Nikki

if you want to store the amount in cent then multiply the amount by 100

$price = 123.45 * 100;

// output
12345

OR if you just want to remove the ., try like this

$price = 123.45;
$price = str_replace('.', '', $price);
echo $price;

// output
12345