Results 1 to 11 of 11
Thread: php
Hybrid View
-
25th April 2009 21:21 #1
php
:
and and
, :
. , . , .
, . , $name . for ?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); }

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!
-
25th April 2009 21:54 #2
-
25th April 2009 21:58 #3function formatAuthors($str) {
$src[] = '/\s+?and\s+?/ui';
$src[] = '/(^|\s)([^\s,])[^\s,]+?\s/ui';
$repl[] = ", ";
$repl[] = ' $1$2. ';
return preg_replace($src, $repl, $str);
}
-
26th April 2009 12:24 #4
trim. * *
-
26th April 2009 13:05 #5
-
26th April 2009 14:03 #6Code:
while( ) { $_ .= $ -> . ","; } echo trim($_, ",");
-
26th April 2009 14:45 #7
-
26th April 2009 16:22 #8
-
26th April 2009 16:50 #9
-
28th April 2009 00:52 #10
@tedych,
"" .
, , , .. - ( ).
@aphex,
$temp_fullnames = ''; .
-
28th April 2009 01:38 #11




Reply With Quote



Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in