Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 21-04-2009
Member
 
Join Date: Oct 2008
Posts: 47
PHP Starter problems

After a period of use of various CMS's, I have begun to recognize the strength of being able to at least basic PHP. I have begun to look at some code that I threw up on my hosting to see what happens.

Now, however, I encountered the patrol, and I can not understand what is wrong. The code is extremely small and simple, like my PHP knowledge with other words.

The following code generates a "Parse error: syntax error, unexpected T_STRING in *******/ test.php on line 6".
PHP Code:
<?php 

$strang1 
This is
$strang2 string
$strang3 $strang1.$strang2
/* This will print: "This is a string"*/ 
echo $strang3

?>
What is wrong?
Reply With Quote
  #2  
Old 21-04-2009
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: PHP Starter problems

$strang1 = This is;
$strang2 = string;

You do not have " around the text?
Reply With Quote
  #3  
Old 21-04-2009
Member
 
Join Date: Apr 2008
Posts: 1,948
Re: PHP Starter problems

<? php

$strang1 = "This is";
$strang2 = "a string";
$strang3 = $strang1.$strang2;
/* This will print: "This is a string" */
echo $strang3;

?>
Reply With Quote
  #4  
Old 21-04-2009
Member
 
Join Date: Oct 2008
Posts: 47
Re: PHP Starter problems

Of course. Rookie mistake, so the whistle on that

Thanks for the quick help!
Reply With Quote
  #5  
Old 21-04-2009
Member
 
Join Date: May 2008
Posts: 2,293
Re: PHP Starter problems

However, one should be mindful of the difference between using:

<?PHP
$name = 'Erik';

// With easy fnuttar evaluated and given no value from $name, but printed as just $name

echo('Hello $name how are you?');

// Dock double fnuttar
echo("Hello $name how are you?");
// To print Hello Erik how are you? out.
?>

In other words. Have you no use to evaluate the variables in a string, so use simple fnuttar.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "PHP Starter problems"
Thread Thread Starter Forum Replies Last Post
Are there any macro or VBE in Office starter available? Apple-Fan Windows Software 3 28-04-2012 07:03 AM
Boot-up problems with Windows 7 starter HarrySkiff Operating Systems 1 26-08-2011 04:17 PM
Limitations of windows 7 Starter Eleder Operating Systems 5 20-04-2011 10:26 PM
Windows 7 Starter OEM Installation PWallace Operating Systems 4 17-12-2010 04:14 AM
Starter GMAT raven.dauntless Education Career and Job Discussions 1 22-09-2008 03:19 PM


All times are GMT +5.5. The time now is 05:12 AM.