unexpected T_STRING

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
ghadacr
Forum Contributor
Posts: 135
Joined: Fri May 11, 2007 10:44 am

unexpected T_STRING

Post by ghadacr »

Hi Guys,

I'm getting an
unexpected T_STRING
output from this piece of code:

Code: Select all

<?PHP

$daterep = str_replace("/","-",$datefrom);
$datereps = str_replace("/","-",$dateto);


$newdate = date ("d M Y", strtotime ($daterep)); 
$newdates = date ("d M Y", strtotime ($datereps)); 

setcookie("from", $newdate, time(  )+600);
setcookie("to", $newdates, time(  )+600);
setcookie("hotel", $subcat, time(  )+600);

$availabilty _days = $_GET['availabilty _days'];

if($availabilty _days > 0) {

$newdate = date('d M Y', strtotime("-$availabilty _days days"));

}

?>
The error seems tobe coming from this line of code:

Code: Select all

if($availabilty _days > 0) {
All help will be apperciated thanks....
Charles256
DevNet Resident
Posts: 1375
Joined: Fri Sep 16, 2005 9:06 pm

Post by Charles256 »

look at your code.it's color coded :-D notice how the variable near that line loses color coding? perhaps due to a space?... :-D
User avatar
ghadacr
Forum Contributor
Posts: 135
Joined: Fri May 11, 2007 10:44 am

Post by ghadacr »

Ok changed it to

Code: Select all

$availabiltydays
but still getting the same error.....
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

There are two occurences of $availabilty _days.
Did you change both? (apparently not)
User avatar
ghadacr
Forum Contributor
Posts: 135
Joined: Fri May 11, 2007 10:44 am

Post by ghadacr »

GOT IT WORKING

Thanks, it was something completely nothing to do with that piece of code......
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

The error message contains a file name and line number, e.g.
Parse error: syntax error, unexpected T_STRING in /home/volker/test.php on line 14
In the future please post the complete error message (includung the line number) and mark the mention line in the code snippet. Much easier for all of us this way.
Post Reply