Results 1 to 10 of 50

Thread: Day 2 - Variables - Become PHP Expert in 30 days

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2009
    Location
    kerala
    Posts
    19,076

    Default String and numeric variables example - day_2_variables_3

    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;
    Created code like above.

    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.

  2. #2
    Join Date
    Feb 2007
    Posts
    26,214

    Default

    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 '.' ;

  3. #3
    Join Date
    Jan 2008
    Location
    india,kerala-god's own country
    Posts
    14,007

    Default

    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 '.';

  4. #4
    Join Date
    Oct 2003
    Location
    Kochi, Kerala, India
    Posts
    21,389

    Default

    DAY 2 PROGRAMMING

    http://php.flashwebhost.com/vineesh/...ariables_3.php

    My Code is as follows:
    Code:
    <?php
    
    $actorName1 = '<b>Mohanlal</b>';
    $actorName2 = '<b>Mammootty</b>';
    $actorName3 = '<b>Suresh Gopi</b>';
    
    $award = '<b>National Film Awards</b>';
    
    $Times1 = 3;
    $Times2 = 1;
    
    echo 'Actor ' . $actorName1 . ' and '  . $actorName2 . ' received ' . $award . ' ' . $Times1 . ' times'; echo '.';
    
    echo '<br> <br>';
    
    echo 'But ' . $actorName3 . ' received it only ' . $Times2 . ' time'; echo '.';

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •