< in ' ' and PHP shouts about syntax error :(

This is a discussion on < in ' ' and PHP shouts about syntax error :( within the PHP Language forums, part of the PHP Programming Forums category; Hi! I`ve got a problem again:( I almoust finished my project and I was doing stupid forms in html ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-06-2003
Maciej Nadolski
 
Posts: n/a
Default < in ' ' and PHP shouts about syntax error :(

Hi!
I`ve got a problem again:(
I almoust finished my project and I was doing stupid forms in html to display as
frontend. I have something like that:
<?php
$wyswietl[] = '
<html>
blahblahblah';

and php shouts:

<b>Parse error</b>: parse error, unexpected '<' in <b>D:\Incoming\WWW\etak.pl
\developer_d
isplay.inc</b> on line <b>3</b><br />
:((
I was sure that a variable can have >1 lines
TIA for any sugestions:(

--
Pozdrawiam,
Maciej Nadolski
Reply With Quote
  #2 (permalink)  
Old 10-06-2003
Kevin Thorpe
 
Posts: n/a
Default Re: < in ' ' and PHP shouts about syntax error :(

Maciej Nadolski wrote:
> Hi!
> I`ve got a problem again:(
> I almoust finished my project and I was doing stupid forms in html to display as
> frontend. I have something like that:
> <?php
> $wyswietl[] = '
> <html>
> blahblahblah';
>
> and php shouts:
>
> <b>Parse error</b>: parse error, unexpected '<' in <b>D:\Incoming\WWW\etak.pl
> \developer_d
> isplay.inc</b> on line <b>3</b><br />
> :((
> I was sure that a variable can have >1 lines
> TIA for any sugestions:(
>


You need heredoc syntax
<?php
$wyswietl[] = <<<EOT
<html>
blahblahblah
EOT;
?>


Reply With Quote
  #3 (permalink)  
Old 10-06-2003
jack
 
Posts: n/a
Default Re: < in ' ' and PHP shouts about syntax error :(

Maciej Nadolski wrote:
> Hi!
> I`ve got a problem again:(
> I almoust finished my project and I was doing stupid forms in html to
> display as frontend. I have something like that:
> <?php
> $wyswietl[] = '
> <html>
> blahblahblah';
>
> and php shouts:
>
> <b>Parse error</b>: parse error, unexpected '<' in
> <b>D:\Incoming\WWW\etak.pl \developer_d
> isplay.inc</b> on line <b>3</b><br />
> :((
> I was sure that a variable can have >1 lines
> TIA for any sugestions:(


use " instead of '

--
--- --- --- --- --- --- ---
jack@croatiabiz.com


Reply With Quote
  #4 (permalink)  
Old 10-06-2003
Thomas Mlynarczyk
 
Posts: n/a
Default Re: < in ' ' and PHP shouts about syntax error :(

Also sprach Maciej Nadolski:

> Hi!
> I`ve got a problem again:(
> I almoust finished my project and I was doing stupid forms in html to
> display as frontend. I have something like that:
> <?php
> $wyswietl[] = '
> <html>
> blahblahblah';
>
> and php shouts:
>
> <b>Parse error</b>: parse error, unexpected '<' in
> <b>D:\Incoming\WWW\etak.pl \developer_d
> isplay.inc</b> on line <b>3</b><br />
> :((
> I was sure that a variable can have >1 lines
> TIA for any sugestions:(


I tried it out, but got no parse error - your syntax above is valid. Maybe
the error is somewhere else?



Reply With Quote
  #5 (permalink)  
Old 10-06-2003
Maciej Nadolski
 
Posts: n/a
Default Re: < in ' ' and PHP shouts about syntax error :(

I solved problem in other way. Thanks:)

--
Best regards,
Maciej Nadolski
Reply With Quote
  #6 (permalink)  
Old 10-07-2003
Phil Roberts
 
Posts: n/a
Default Re: < in ' ' and PHP shouts about syntax error :(

With total disregard for any kind of safety measures Kevin Thorpe
<kevin@pricetrak.com> leapt forth and uttered:

> You need heredoc syntax
> <?php
> $wyswietl[] = <<<EOT
> <html>
> blahblahblah
> EOT;
> ?>
>


You cannot indent the end token in a heredoc, it must be placed on
the first column. (corrected to demonstrate)



--
There is no signature.....
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 06:33 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0