Home  >  Article  >  Backend Development  >  How to convert hours to minutes in php

How to convert hours to minutes in php

WBOY
WBOYOriginal
2022-02-11 16:34:592874browse

In PHP, you can use the "*" arithmetic operator to convert hours into minutes. This operator is used to calculate the product of the preceding and following numbers. Multiply the specified number of hours by 60 to convert it into the specified number of minutes. , the syntax is "specified hour object * 60".

How to convert hours to minutes in php

The operating environment of this tutorial: windows10 system, PHP version 7.1, DELL G3 computer

How to convert hours to minutes in php

To convert hours into minutes, you need to use arithmetic operators.

Operators refer to certain symbols that generate another value through one or more expressions, such as " ", "%", ".", etc. are all operators.

In the expression 2 1, the operator " " has two operands, 1 and 2. An operator with two operands can be called a binary operator, and an operator with one operand is called a unary operator. For example, in the expression -6, the operator "-" has only one operand 6, so the "-" here is a unary operator.

Next, I will give you a brief introduction to the commonly used operators in PHP.

The Arithmetic Operators symbol is a symbol used to process the four arithmetic operations (addition, subtraction, multiplication, and division), and is most commonly used in number processing.

The example is as follows:

<?php
$hour= "24";
$min=$hour*60;
echo "24小时转化为".$min."分钟";
?>

Output result:

How to convert hours to minutes in php

Recommended learning: "PHP Video Tutorial"

The above is the detailed content of How to convert hours to minutes in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn