Php 2ம் பாடம் | பல்சுவை தகவல்கள் - Thagavalgal in Tamil Php 2ம் பாடம் ~ பல்சுவை தகவல்கள் - Thagavalgal in Tamil

பல்சுவை தகவல்கள் - Thagavalgal in Tamil- Interesting Information in Tamil Useful Information you should know - Computer Tips, Health Tips, online offers, and more helpful Tips and Tricks நீங்கள் தெரிந்து கொள்ள வேண்டிய பயனுள்ள தகவல்கள்

வெள்ளி, 13 ஜூன், 2014

Php 2ம் பாடம்

Strings in php.

Strings என்பது எழுத்துக்களின் கோவையாகும்.
பின் வருவன string க்கு உதாரணங்கள் ஆகும்.
Chennai”
‘100’
“November 14,2011”
இவை single Quotes அல்லது double quotes க்கு இடையே எழுதப்படுகின்றன.
பின் வரும் string ஐ எடுத்துக்கொள்வோம்.
$var=”“my place “Madurai” is in tamilnad”.

அதாவது quotes க்குள் quotes  வந்துள்ளது .
இதை சரி செய்ய
quotesescape செய்ய வேண்டும்.
$var=“my place \“Madurai\” is in tamilnad”.
Echo() அல்லது print() உபயோகித்து strings ஐ  பிரிண்ட் செய்யலாம்.
echo $var;
print $var;
$name=”vijay”;
echo “hello ,$name”;
மேலே உள்ள வாக்கியத்தில் $name ஆனது விரிவாக்கப்பட்டு
hello vijay
என உலாவியில் (browser) வெளியீடு செய்யப் படுகின்றது.


 <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
        <title></title>
    </head>
    <body>
        <?php
          $first_name="muthu" ; // put your code here;
          $last_name="karthikeyan";
          $full_name=$first_name.' '.$last_name;
          $place="madurai";
          echo "<p><em>$full_name</em> residing at $place</p> ;
"
        ?>
    </body>
</html>
மேலே உள்ள நிரலில் $name மற்றும் $place  விரிவாக்கப்பட்டு பின் வருமாறு
உலாவியில் வெளியீடு செய்யப்படுகின்றது.


மேலே உள்ள நிரலில் உள்ளவாறு இரு string களை இணைப்பதற்கு dot பயன் படுத்தப்படுகின்றது
உதாரணம் :
$full_name=$first_name. ’  ‘.$last_name.

Strlen என்ற function கொண்டு  ஒரு string ன் நீளத்தை அறியலாம்.
Example:
$num=strlen(‘some string’);
மேலும் சில string functions
Strtolower -lowercase letter க்கு மாற்றுவது
Strtoupper  -uppercase letter க்கு மாற்றுவது
Ucfirst    -stringன் முதல் எழுத்தை மட்டும் uppercase letter க்கு மாற்றுவது
Ucwords   -string ன் ஒவ்வொரு வார்த்தையின் முதல் எழுத்தை மட்டும் uppercase letter க்கு மாற்றுவது
ஒரு string உடன் இன்னொரு stringஐ இணைத்தால் concatenation assignment operator ஐ உபயோகிகலாம்.
 
Example.
$name=$name. $lastname
என்பதை
$name.=$lastname
என எழுதலாம்.
-தொடரும்

Popular Posts

Facebook

Blog Archive