SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2010
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to convert text, symbol and numeric datat to string

    Hi


    I want to convert the data which contains text, symbol and numbers. I want to convert them to string.

    for example $t = amp;2011-07-07

    this data I am getting from url. I want to make it as a string.



    Thanks

    MD.Samiuddin

  2. #2
    Keeper of the SFL StarLion's Avatar
    Join Date
    Feb 2006
    Location
    Atlanta, GA, USA
    Posts
    3,748
    Mentioned
    69 Post(s)
    Tagged
    0 Thread(s)
    $t = amp;2011-07-07

    This line wont work as is, because PHP doesnt know what 'amp' means.

    $t = "amp;2011-07-07";

    Now PHP knows what that is - it's a string. Or at least, it's a potential string.

    PHP is loosely typed for basic data types; so...
    PHP Code:
    $t "1";
    $t++;
    echo 
    $t//2 
    PHP took my string, 1, saw that i wanted to do a mathematical operation for it, implicitly converted it to an numerical value, added 1 to it, and then output it as a string again.


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
  •