|
|
|
|
![]() ![]() |
Oct 19 2007, 05:51 AM
Post
#11
|
|
|
Super Member Group: [HOSTED] Posts: 794 Joined: 8-April 06 From: Lima - Peru Member No.: 12,579 myCENTs:78.07 |
I guess that pyost get confuse with the implode() php function, which accepts its parameters in any order and do the opposite task -join- of the explode() php function.
BTW, the explode function has one more parameter that you can use to limit the maximum of limit elements, but for this case you don't need to use. Best regards, |
|
|
|
Oct 19 2007, 11:54 AM
Post
#12
|
|
|
Nenad Bozidarevic Group: [MODERATOR] Posts: 1,043 Joined: 7-November 05 From: Belgrade, Serbia Member No.: 9,500 myCENTs:38.31 |
Nope, I don't know either of them by heart, I just visit php.net every time I need them
|
|
|
|
Oct 26 2007, 03:45 AM
Post
#13
|
|
|
Super Member Group: [HOSTED] Posts: 737 Joined: 12-July 06 From: Ontario, Canada Member No.: 14,464 |
Ok, how come no one suggested month() or monthname() ? I just found out those two.
|
|
|
|
Oct 26 2007, 08:51 AM
Post
#14
|
|
|
Nenad Bozidarevic Group: [MODERATOR] Posts: 1,043 Joined: 7-November 05 From: Belgrade, Serbia Member No.: 9,500 myCENTs:38.31 |
There are no such functions in PHP5, or at least according to www.php.net.
|
|
|
|
Oct 26 2007, 09:23 AM
Post
#15
|
|
|
Premium Member Group: [HOSTED] Posts: 408 Joined: 16-February 06 From: Kolkata, India Member No.: 11,322 myCENTs:32.75 |
I used to get confused by the same very thing. In some of the PHP functions, the order of parameters does defy the common logic. VB & C# support the split function as Split(<StringToSplit>, <Delimeter>). Another such function is str_replace which takes the syntax str_replace(<ReplaceWhat>, <ReplaceWith>, <ReplaceIn>). Again logic says that the source string must be the first parameter as is in, VB & C# - Replace(<ReplaceIn>, <ReplaceWhat>, <ReplaceWith>).
In C#, the Split() and Replace() methods are built into the string object itself. So, the first parameter (Source string) is not specified as the parameter. Rather, these method are called as SourceString.Split() or SourceString.Replace(). But, the thing is same, the source string must be specified before other parameters. |
|
|
|
Oct 26 2007, 12:43 PM
Post
#16
|
|
|
Super Member Group: [HOSTED] Posts: 737 Joined: 12-July 06 From: Ontario, Canada Member No.: 14,464 |
There are no such functions in PHP5, or at least according to www.php.net. There are date and time functions here on dev.mysql.com, exact url is http://dev.mysql.com/doc/refman/5.0/en/dat...-functions.html. |
|
|
|
Oct 27 2007, 03:17 AM
Post
#17
|
|
|
Super Member Group: [HOSTED] Posts: 794 Joined: 8-April 06 From: Lima - Peru Member No.: 12,579 myCENTs:78.07 |
There are no such functions in PHP5, or at least according to www.php.net. That's correct, but you can obtain the month name easily using the strftime(), strtotime(), date() and time() php functions together or directly with the MONTHNAME() MySql function: CODE <?php // php functions $monthname=strftime("%B",strtotime(date("d-m-Y",time()))); // MySql function $sql="SELECT MONTHNAME('2007-10-26') as mname"; $rs=mysql_query($sql) or die('Error...'); $row=mysql_fetch_array($rs); $mname=$row["mname"]; echo "Month Name with Php: " . $monthname; echo "<br />Month Name with MySql: " . $mname; ?> Best regards, |
|
|
|
Oct 27 2007, 08:12 AM
Post
#18
|
|
|
Nenad Bozidarevic Group: [MODERATOR] Posts: 1,043 Joined: 7-November 05 From: Belgrade, Serbia Member No.: 9,500 myCENTs:38.31 |
There are date and time functions here on dev.mysql.com, exact url is http://dev.mysql.com/doc/refman/5.0/en/dat...-functions.html. Heh, didn't think of checking MySQL functions |
|
|
|
![]() ![]() |
Similar Topics
|
Lo-Fi Version | Time is now: 20th November 2008 - 04:59 PM |