Results 1 to 10 of 50

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

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #20
    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.

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
  •