CTSchmidt
CTSchmidt

Reputation: 1205

how to store a string with newline into php array

My goal is to store a newline character in an array. I want to display it later on a site.

$settings['standard'] = array(
            'title'       => __( 'Standard', 'foo' ),
            'description' => __( 'description text with 
newline character', 'fooMore' ));

the output have to something like this:

description text with
newline character

Upvotes: 0

Views: 220

Answers (1)

Blaatpraat
Blaatpraat

Reputation: 2839

$settings['standard'] = array(
        'title'       => __( 'Standard', 'foo' ),
        'description' => __( 'description text with' . PHP_EOL . 'newline character', 'fooMore' ));

PHP_EOL is the End Of Line character for your current environment (LF, CR or CRLF).

Upvotes: 4

Related Questions