Buying Need simple PHP code -- Will Pay Today!

Discussion in 'Programming' started by GasMan320, Sep 25, 2012.

  1. #1
    I need a PHP hack that does the following:


    -Changes the first letter of every word in a sentence to uppercase
    -Ignores certain defined short words (a, of, the, etc) and leaves them lowercase.
    -Ignores certain defined all caps words (USA, IMHO, BRB, etc) and leaves them capitalized.
    -Ignores capitalized words that are X number of characters or less and leaves them capitalized.
    -Correctly handles punctuation marks at the end of a word (comma, question mark, exclamation, etc)

    PM me with a price and send me your skype details if you have one so we can discuss further. I need this done today and will pay today!

    I have plenty of positive feedback on here -- just look at my previous posts.

    Thank you!
     
    GasMan320, Sep 25, 2012 IP
  2. Syndication

    Syndication Active Member

    Messages:
    351
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    90
    As Seller:
    100% - 3
    As Buyer:
    100% - 0
    #2
    <?php
    $string = "this is a test string"; // Your input string
    $exclude_words = array("the","a","of","is"); // Exclude analyzing these words
    $max_length = 10; // Maximum word length, anything over is ignored
    
    $parts = explode(" ",$string);
    foreach ($parts as $word) {
     if (!in_array(strtolower($word),$exclude_words) && strlen($word) <= $max_length) {
      $first_letter = substr($word,0,1);
      $newWord = strtoupper($first_letter).substr($word,1);
      $string = str_replace($word,$newWord,$string);
     }
    }
    
    echo $string; // This should output "This is a Test String"
    ?>
    Code (markup):
    Untested, but should work & suit your needs.
     
    Syndication, Sep 25, 2012 IP
  3. GasMan320

    GasMan320 Well-Known Member

    Messages:
    312
    Likes Received:
    56
    Best Answers:
    0
    Trophy Points:
    120
    As Seller:
    100% - 0
    As Buyer:
    100% - 0
    #3
    So many thanks to Syndication -- this guy is a complete all star! Helped me out and was so nice and generous with his time!!! :D :D :D
     
    GasMan320, Sep 25, 2012 IP
  4. ryandanielt

    ryandanielt Well-Known Member

    Messages:
    1,797
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    185
    As Seller:
    100% - 2
    As Buyer:
    100% - 0
    #4

    Of course its untested, simple copy and paste of someone else's work. There are many other ways to go about this that will actually shorten the amount of code. Next time try posting the article URL with your source, some people put serious effort into developing these snipits and they share it because its a passion to them.

    http://pastebin.com/XtYiTyfy

    Simple google search on mostly anything you find now a days will give you the heads up if your buying someone elses work or something that you could have read up on yourself.
     
    ryandanielt, Sep 28, 2012 IP
  5. Cucumba123

    Cucumba123 Well-Known Member

    Messages:
    1,403
    Likes Received:
    34
    Best Answers:
    3
    Trophy Points:
    150
    As Seller:
    100% - 1
    As Buyer:
    100% - 1
    #5
    How can you be sure it's not him who shared it on pastebin.com?
     
    Cucumba123, Sep 29, 2012 IP