Ternary operators

The same rule as for if clauses also applies for the ternary operator: It may be split onto several lines, keeping the question mark and the colon at the front.

<?php

$a 
$condition1 && $condition2
    
$foo $bar;

$b $condition3 && $condition4
    
$foo_man_this_is_too_long_what_should_i_do
    
$bar;
?>
Split long if statements onto several lines (Previous) Alignment of function parameters (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.