Results 1 to 2 of 2

Thread: Functions in PHP

  1. #1
    Join Date
    Nov 2009
    Posts
    76,596

    Default Functions in PHP

    Functions are reusable pieces of code that you can use throughout an application, saving you lots of copying and pasting.

    PHP has lots of built-in functions, and we'll learn some of them in these exercises. The first set of functions we'll learn about are string manipulation functions.

    strlen() is one of the most common String functions in PHP. You pass it a string, or variable containing a string, and it returns the number of characters in that string.

    Code:
    <html>
    <p>
    <?php
    // get the length of a string and
    // print it to the screen
    ?>
    </p>
    </html>

  2. #2
    Join Date
    Sep 2003
    Posts
    3,040

    Default

    Code:
    <?php
    
    $str1 = "Eating cat is not good for rat";
    echo strlen($str1);
    Become PHP Expert in 30 days
    FreeMarriage.com - Free Online Matrimonial
    FlashWebHost.com - Professional Web Hosting, Designing.

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
  •