[PHP] How to Insert Line Breaks Within the Same Cell in Excel Output

Tadashi Shigeoka ·  Tue, October 16, 2012

When you want to set a string containing line breaks to an Excel cell in PHP, use PHP_EOL.

$cell = 'Before line break' . PHP_EOL . 'After line break';

Reference Information

Excel出力時の同一セル改行 - Webエンジニアの技術メモ ~PHP、SQL、Linuxなど~

いまさらながらPHP_EOL定数と改行コードについて | 深追い Fukaoi.org

That’s all from the Gemba.