Results 1 to 11 of 11

Thread: php

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Eclipse Plugin Developer aphex's Avatar
    Join Date: Mar:2003
    Location: Karlsruhe
    Posts: 546

    php

    :

    and and

    , :

    . , . , .


    Code:
     function formatAuthors($author_string) {
    		$fullnames = split(" * and *", $author_string);	
    		foreach($fullnames as $name){
    		$per_name = split(" ", $name);
    		$per_name[0] = substr($per_name[0], 0, 1);
    		$name=join(". ",$per_name);
    		}
        return join(", ", $fullnames);	
      }
    , . , $name . for ?



    PS. . .

    Code:
      function formatAuthors($author_string) {
    		$fullnames = split(" * and *", $author_string);	
    		foreach($fullnames as $name){
    		$per_name = split(" ", $name);
    		$per_name[0] = substr($per_name[0], 0, 1);
    		$name=join(". ",$per_name);
    		$temp_fullnames=$temp_fullnames.", ".$name;
    		}
        return substr($temp_fullnames,2,strlen($temp_fullnames));	
      }
    Last edited by aphex; 25th April 2009 at 21:44.
    We are drowning in information, but starving for knowledge and time!

  2. #2
    N/A Demoman's Avatar
    Join Date: Sep:2005
    Location:
    Posts: 3,098
    Quote Originally Posted by aphex View Post
    for ?
    PHP

  3. #3
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    function formatAuthors($str) {
    $src[] = '/\s+?and\s+?/ui';
    $src[] = '/(^|\s)([^\s,])[^\s,]+?\s/ui';
    $repl[] = ", ";
    $repl[] = ' $1$2. ';
    return preg_replace($src, $repl, $str);
    }

  4. #4
    White awesomeness z0ne's Avatar
    Join Date: Feb:2002
    Location: o
    Posts: 13,331
    trim. * *

  5. #5
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    Quote Originally Posted by z0ne View Post
    trim. * *
    - trim() ?

  6. #6
    White awesomeness z0ne's Avatar
    Join Date: Feb:2002
    Location: o
    Posts: 13,331
    Code:
    while( ) {			
        $_ .= $ ->  . ",";			
    }
    echo trim($_, ",");

  7. #7
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    , " " , trim .
    , .., implode/explode .

  8. #8
    White awesomeness z0ne's Avatar
    Join Date: Feb:2002
    Location: o
    Posts: 13,331
    Quote Originally Posted by tedych View Post
    , " " , trim .
    , .., implode/explode .
    ** , . .

  9. #9
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    Quote Originally Posted by z0ne View Post
    ** , . .
    , , and trim() . .
    , , .

  10. #10
    a.k.a. Bibi Flower's Avatar
    Join Date: Aug:2006
    Location: Sofia, Bulgaria
    Posts: 562
    @tedych,
    "" .
    , , , .. - ( ).

    @aphex,
    $temp_fullnames = ''; .

  11. #11
    Registered User tedych's Avatar
    Join Date: Nov:2003
    Location:
    Posts: 17,654
    Quote Originally Posted by Flower View Post
    @tedych,
    "" .
    , , , .. - ( ).
    .
    , , .
    .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |