Html::nl2br_deep PHP Method

nl2br_deep() static public method

Recursivly execute nl2br on an Array
static public nl2br_deep ( $value ) : array
$value string or array
return array of value (same struct as input)
    static function nl2br_deep($value)
    {
        return is_array($value) ? array_map(array(__CLASS__, 'nl2br_deep'), $value) : nl2br($value);
    }

Usage Example

Example #1
0
 /**
  * @covers Html::nl2br_deep
  */
 public function testNl2br_deep()
 {
     $origin = "A string\nwith breakline.";
     $expected = "A string<br />\nwith breakline.";
     $this->assertEquals($expected, Html::nl2br_deep($origin));
     $origin = ["Another string\nwith breakline.", "And another\none"];
     $expected = ["Another string<br />\nwith breakline.", "And another<br />\none"];
     $this->assertEquals($expected, Html::nl2br_deep($origin));
 }
All Usage Examples Of Html::nl2br_deep
Html