> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PHP Multiplication

The `*` operator in PHP is a binary arithmetic operator used for multiplication. It calculates and returns the mathematical product of two numeric operands.

```php theme={"dark"}
$result = $expression1 * $expression2;
```

## Precedence and Associativity

* **Precedence:** The `*` operator has higher precedence than addition (`+`) and subtraction (`-`), but shares the same precedence level as division (`/`) and modulo (`%`).
* **Associativity:** It is left-associative. In an expression containing multiple operators of the same precedence level, evaluation proceeds strictly from left to right.

## Type Resolution and Coercion

The behavior and return type of the `*` operator depend strictly on the data types of the evaluated operands and the platform's integer limits:

* **Integer Evaluation:** If both operands are of type `int`, the operator returns an `int`, provided the resulting product does not exceed the platform's maximum integer threshold (`PHP_INT_MAX`) and does not fall below the platform's minimum integer threshold (`PHP_INT_MIN`).
* **Float Evaluation:** If at least one operand is of type `float`, the operator returns a `float`.
* **Integer Overflow and Underflow:** If the product of two `int` operands exceeds `PHP_INT_MAX` (positive overflow) or falls below `PHP_INT_MIN` (negative overflow), PHP automatically promotes the return type to a `float` to accommodate the magnitude of the value.
* **Implicit Coercion:** If an operand is a numeric string (e.g., `"5"` or `"3.14"`), PHP implicitly casts the string to the corresponding `int` or `float` type before performing the multiplication.
* **Strict Typing Exceptions:** In PHP 8.0 and later, attempting to use the `*` operator on non-numeric strings or incompatible types (like arrays or objects without numeric casting capabilities) throws a `TypeError`.

## Syntax Visualization

```php theme={"dark"}
// Standard integer multiplication (Returns int)
$val1 = 4 * 3;           // int(12)

// Float multiplication (Returns float)
$val2 = 4.5 * 2;         // float(9.0)

// Mixed type multiplication (Returns float)
$val3 = 5 * 1.2;         // float(6.0)

// Implicit type coercion from numeric string (Returns int)
$val4 = "10" * 5;        // int(50)

// Integer overflow promotion (Returns float)
$val5 = PHP_INT_MAX * 2; // float(...)

// Integer underflow promotion (Returns float)
$val6 = PHP_INT_MIN * 2; // float(...)

// Precedence and left-associativity
$val7 = 2 + 3 * 4;       // int(14)  (Multiplication evaluates before addition)
$val8 = 10 / 2 * 5;      // int(25)  (Evaluates left-to-right: (10 / 2) * 5)
```

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor PHP Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
