Questions tagged [nowdoc]

21 questions
0
votes
1 answer

PHP str_replace doesn't find multiline NOWDOC text

My understanding is that using the NOWDOC functionality in PHP (v5.3 and higher), no escaping of characters is required. I'm trying to find and replace text in a PHP file. The text is: $OldString = <<<'EOD'
Simon Roberts
  • 617
  • 1
  • 7
  • 14
0
votes
4 answers

Some unclear PHP syntax

I am a PHP beginner and saw on the forum this PHP expression: My PHP version is 5.2.X () $regex = <<<'END' / ( [\x00-\x7F] # single-byte sequences 0xxxxxxx | [\xC0-\xDF][\x80-\xBF] # double-byte sequences 110xxxxx…
serhio
  • 28,010
  • 62
  • 221
  • 374
0
votes
4 answers

What characters need to be escaped when echoing Javascript in PHP?

I'm trying to echo out the Javascript for the Google AdWords conversion tracking code within a PHP if statement. I've done a bunch of googling but can't seem to find a definitive list of what characters I'd need to escape to have the code execute…
Mike
  • 1
  • 2
0
votes
1 answer

Php nowdoc (heredoc without parsing) is interpreting HTML Markup Characters - Not Desireable

I have PHP that looks like this: $func_code = <<<'EOT' foo1 foo2 ''. foo4 . '
'; EOT; echo $func_code; And the output looks like this: one_half foo1 foo2 ''. foo4 . ''; foo1 foo2 ''. foo4 . ''; As you can see, and are both…
JamesHoux
  • 2,999
  • 3
  • 32
  • 50
-3
votes
1 answer

PHP us a string variable as an argument for function

I am trying to set a variable as a string and then use that variable in a while loop function. $row['name'], 'foreman_position'=> $row['foreman_position'], 'status'=> $row['status'],…
John
  • 3
  • 1
-3
votes
2 answers

How can I write PHP syntax in a string

I tried to write some content in order to write in a php file and in my $content variable i use Heredoc and nowdoc but php tags seems not working and are still shown. $content = <<< EOT
Tom
  • 3
  • 2
1
2