Download this Blogger Template by Clicking Here!

Ad 468 X 60

Wednesday 13 March 2013

Widgets

Change Data Type Using Functions And Print Special Characters In Php

Data Type Conversion Using Functions In PHP :



Special Characters In Php
Special Characters In Php


There are some other ways to change the data type of available without using Type casting. There are some functions that change the data type of a variable .

For example

  • intval (value) ;
It takes a value (whose data type we want to change ) as input and returns an integer data type output .

    • double (value);
    It takes a value (whose data type we want to change )  as input and returns a double data type output .

    • strval (value) ;
    It takes a value (whose data type we want to change )  as input and returns a string data type output .


    Print Special Characters In Php :


    One thing I forgot in my previous post that we can use echo or print statement for printing output on screen. If you want to print a special character on screen like double quotes (") or single quote ( ' ) or backslash ( \ ), then we can print these by using a backslash . See the example to understand



    <?php

    echo "He said : \ " I love Pakistan \" ";

    ?>


    Output

    He said : "I love Pakistan "

    In above statement you can see that I wanted to print double quotes on the screen so that I used backslash. If you want to print the name of the variable instead of its value then use single quotes in echo statement


    <?php

    $city = "Karachi";

    echo 'City is : $city '. '<br/>;

    echo " City is : $city ";

    ?>




    Output




    City is : $city

    City is : Karachi



    Change Data Type And Print Special Characters In Php
    Change Data Type  And Print Special Characters In Php

    " Share With Others And Care Others "

    SHARE THIS POST   

    • Facebook
    • Twitter
    • Myspace
    • Google Buzz
    • Reddit
    • Stumnleupon
    • Delicious
    • Digg
    • Technorati
    Author: Mohammad
    Mohammad is the founder of STC Network which offers Web Services and Online Business Solutions to clients around the globe. Read More →

    0 comments: