Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Can anyone see the error with this php code
Old 12-09-2011, 07:33 PM Can anyone see the error with this php code
Skilled Talker

Posts: 97
Trades: 0
Im new to PHP and Im getting this error
Parse error: syntax error, unexpected '=', expecting ',' or ';' in C:\wamp\www\php_sandbox\00800 strings_functions.php on line 24
This is line 24
Trim: <?php echo fourthString = $firstString . trim($secondString); ?><br />


Thanks for any help






<html>
<head>
<title>Strings Functions</title>
</head>
<body>
<?php
$firstString="The quick brown fox";
$secondString=" jumped over the lazy dog.";
?>

<?php
$thirdString = $firstString;
$thirdString .= $secondString;
echo $thirdString;
?>

<br />
Lowercase: <?php echo strtolower($thirdString); ?><br />
Uppercase: <?php echo strtoupper($thirdString); ?><br />
Uppercase first-letter: <?php echo ucfirst($thirdString); ?><br />
Uppercase words: <?php echo ucwords($thirdString); ?><br />
<br />
Length: <?php echo strlen($thirdString); ?><br />
Trim: <?php echo fourthString = $firstString . trim($secondString); ?><br />
Find: <?php echo strstr($thirdString, "brown"); ?><br />
Replace by string: <?php echo str_replace("quick", "super-fast",$thirdString); ?><br />



</body>

</html>
keithkiss is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-09-2011, 08:26 PM Re: Can anyone see the error with this php code
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
There are a two things wrong with that line. The first is you forget the $ on fourthString. The second is that you are assigning a value and outputting that value in the same expression, which technically will work, but it's bad code.

Try:
PHP Code:
$fourthString $firstString trim($secondString);
echo 
$fourthString
or skip the assignment all together and do:
PHP Code:
echo $firstString trim($secondString); 
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is offline
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 12-13-2011, 05:41 PM Re: Can anyone see the error with this php code
Skilled Talker

Posts: 97
Trades: 0
found out my problems.... main problem is the PHP on the server was acting up... thanks
keithkiss is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Can anyone see the error with this php code
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.32325 seconds with 12 queries