I didn't get the correct answer. http://php.flashwebhost.com/sherly/variable.php
Code:<?php $variable12 = $variable7 + $variable5; echo $variable7; echo " + "; echo $variable5; echo " = "; echo $variable12;
I didn't get the correct answer. http://php.flashwebhost.com/sherly/variable.php
Code:<?php $variable12 = $variable7 + $variable5; echo $variable7; echo " + "; echo $variable5; echo " = "; echo $variable12;
http://php.flashwebhost.com/sherly/age.php
Code:<?php $name = 'Joseph'; $yearBorn = 1975; $currentYear = 2014; $age = $currentYear - $yearBorn; print ("$name is $age years old. ")
Semicolon at end of print statement missing.
print function same as echo, but use echo, forget print. echo is more popular, also there are more ways to print, some complicated, but is not required for most programming project.
Proper usageCode:print ("$name is $age years old. ")
OrCode:echo $name . ' is ' . $age . ' years old. ';
Advantage of using single quote is PHP know it is just string, so it will be faster. If using double quote, PHP compilter need to look for variable inside the string and convert it to its value, that need more processing time (not much, still do that way as a convention whenever possible).Code:echo "$name is $age years old. ";
Become PHP Expert in 30 days
FreeMarriage.com - Free Online Matrimonial
FlashWebHost.com - Professional Web Hosting, Designing.
http://php.flashwebhost.com/vineesh/...ariables_2.php
I was facing difficulty to insert a full stop after a sentence. But I managed to make it work. My code is
Is there any issue with this ?Code:<?php $staffName = 'Ramesh'; $companyName = 'HOSTONNET'; $staffName2 = 'Suresh'; $staffName3 = 'Tom'; echo $staffName . ' is working in ' . $companyName; echo '.'; echo ' But '; echo $staffName2; echo ' not.' ; echo '<br>'; echo $staffName3 . ' also working in ' . $companyName . 'for the past 10 years'; echo '.';
DAY 2 PHP PROGRAMMING
http://php.flashwebhost.com/tom/day_2_variables_1.php
Code:<?php $MovieName = '<b>Mr. Fraud</b>'; echo $MovieName ;
DAY 2 PROGRAMMING
http://php.flashwebhost.com/tom/day_2_variables_2.php
Code:<?php $MovieName = '<b>Mr. Fraud</b>'; echo 'Mohanlal\'s Upcoming Movie ' . $MovieName;
DAY 2 PROGRAMMING
http://php.flashwebhost.com/tom/day_2_variables_3.php
Code:<?php $MovieName = 'Mr. Fraud' ; $Starring = 'Mohanlal, Siddique, Dev Gill, Pallavi, Mia, Manjari' ; $Director = 'B. Unnikrishnan' ; echo $MovieName . ' is a malayalam movie, ' . $Director . ' is the Director. ' . $Starring . ' in the lead roles. ' ;
Created code like above.Code:<?php $brand = 'Sony Xperia J'; $product = 'Mobile'; $android = 'Jelly Bean 4.3'; $shop = 'Flipkart'; echo ' Purchased ' . $brand . $product . ' from ' . $shop . ' . Android version is ' . $android;
Result below
Purchased Sony Xperia JMobile from Flipkart . Android version is Jelly Bean 4.3
there is no gap between xperia j and Mobile.
So i just added the . ' ' . to get space.
echo ' Purchased ' . $brand . ' ' . $product . ' from ' . $shop . ' . Android version is ' . $android;
2 doubts
1. Is there any issue if two variables come together ? ($brand . ' ' . $product .)
2. any problem if we use quote ,when we have text and numeric values ($android = 'Jelly Bean 4.3';). I just tried by removing the quote. but showing error message.
Last edited by Vahaa11; 05-09-2014 at 10:30 AM.
DAY 2 PROGRAMMING
http://php.flashwebhost.com/tom/example.php
Code:<?php $MovieName = 'Mr. Fraud' ; $Starring = 'Mohanlal, Siddique, Dev Gill, Pallavi, Mia, Manjari' ; $writtenDirector = 'B. Unnikrishnan' ; $Banner = 'A.V.A Productions' ; $Producer = 'A. V. Anoop' ; $Cinematography = 'Satheesh Kurup' ; $Music = 'Gopi Sunder' ; $lyrics = 'Hari Narayanan & Chittoor Gopi' ; $editing = 'Manoj' ; $stuntchoreography = 'Stunt Silva' ; $ReleaseDate = 'May 17' ; echo $MovieName . ' is a Malayalam heist film written and directed by ' . $writtenDirector . ' and starring ' . $Starring . 'in the lead roles. The film is produced by ' . $Producer . ' under the banner ' . $Banner ; echo '.' ; echo ' The film\'s music composed by ' . $Music . ', with lyrics penned by ' . $lyrics . ' Cinematography is handled by ' . $Cinematography . ', editing is by ' . $editing . ' and stunt choreography is by ' . $stuntchoreography ; echo '.' ; echo ' The shooting has been completed on April first week and already two teasers are out. The trailer and songs are commenced to release on April 25. The movie is decided to release on ' . $ReleaseDate ; echo '.' ;
DAY 2 PROGRAMMING - My Post
http://php.flashwebhost.com/ramesh/study2.php
Code:<?php $film = 'Gangster'; echo 'Film: ' . $film; echo '. <br>'; $actor = 'Mammootty'; echo 'Actor: ' . $actor; echo '. <br>'; $actress = 'Nyla Usha'; echo 'Actress: ' . $actress; echo '. <br>'; $director = 'Aashiq Abu'; echo 'Director: ' . $director; echo '.';
Bookmarks