Advanced Search

Results 1 to 3 of 3

Thread: PHP array

  1. #1
    Join Date
    Nov 2010
    Posts
    114
    Thanks
    27
    Thanked 0 Times in 0 Posts

    Default PHP array

    Hi All,

    I just want to know if thr is any function for the follwoing

    $Name = dynamicdrive;

    Now i want the 6th character alone should become capital. If it is possible help me out

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    No function that I know of but

    PHP Code:
    <?php
    $Name 
    "dynamicdrive";
    $become substr($Name04) . strtoupper(substr($Name51)) . substr($Name6);
    ?>
    should do it. I also don't understand the title of this, is there something to do with arrays?
    Corrections to my coding/thoughts welcome.

  3. #3
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,622
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    you can access strings by character offset, but they're still strings, not arrays.
    PHP Code:
    $str 'dynamicdrive';
    $str[0] = strtoupper($str[0]);
    $str[7] = strtoupper($str[7]);
    print 
    $str// prints "DynamicDrive" 
    We Only Torture the Folks We Don't Like (You're Probably Gonna Be Okay)
    It's a Party in the CIA

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
  •