Re: [PHP] Function size

2012-05-29 Thread Robert Cummings
On 12-05-29 07:17 AM, Stuart Dallas wrote: > I wasn't going to respond to this thread because I think it's a largely > ridiculous topic, but some of the responses have scared me. Sir Cummings > (hopefully) sarcastic response about using a 5px font size demonstrated > how daft it is to base funct

Re: [PHP] Function size

2012-05-29 Thread Paul M Foster
On Tue, May 29, 2012 at 11:56:47AM -0400, Tedd Sperling wrote: > On May 29, 2012, at 10:20 AM, Stuart Dallas wrote: > > > -snip- Besides, truth is subjective, but then so is everything, > > including that assertion. > > > > -Stuart > > You reply was longer than my monitor was high so I can't gi

Re: [PHP] Function size

2012-05-29 Thread Tedd Sperling
On May 29, 2012, at 5:06 PM, Paul M Foster wrote: > > I think a lot of coders try to be kewler than the next 18 guys who are > gonna have to look at the code, so they use a lot of "compression" > techniques to reduce LOC. That's not kewl to me. > Plus, they're lazy. I'd rather see everything > w

Re: [PHP] Function size

2012-05-29 Thread Matijn Woudt
> The art of software development is in taking a problem, breaking it up in to > bite-size chunks, and putting those chunks together to form a practical > solution. Anyone who considers themselves a "better" programmer because their > functions are large due to their ability to handle large func

Re: [PHP] Function size

2012-05-29 Thread Tedd Sperling
On May 29, 2012, at 10:20 AM, Stuart Dallas wrote: > -snip- > Besides, truth is subjective, but then so is everything, including that > assertion. > > -Stuart You reply was longer than my monitor was high so I can't give an immediate reply -- I have to scroll. :-) However, with that said, you

Re: [PHP] Function size

2012-05-29 Thread Stuart Dallas
On 29 May 2012, at 14:38, Tedd Sperling wrote: > On May 29, 2012, at 7:17 AM, Stuart Dallas wrote: >> >> It's a theory, yes, and for many people it may be valid, but it's not for >> me. The resolution of your screen; the size of your font; the colour scheme >> you use. These should not be a fac

Re: [PHP] Function size

2012-05-29 Thread Stuart Dallas
On 23 May 2012, at 15:14, Tedd Sperling wrote: > Hi gang: > > On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote: >> A rule of thumb is no more than 50 lines per >> function, most much less. Back in the day when we didn't have nifty >> gui screens and an 24 line terminals (yay green on blac

Re: [PHP] Function size

2012-05-25 Thread Tedd Sperling
On May 24, 2012, at 5:01 PM, Ashley Sheridan wrote: > On Thu, 2012-05-24 at 15:48 -0500, tamouse mailing lists wrote: >> On May 23, 2012 9:14 AM, "Tedd Sperling" > > wrote: >> > >> > H >> Yes, I think that is *exactly* the criterion-- not a mystery or an emergent >> thing, really, was a pretty exp

Re: [PHP] Function size

2012-05-24 Thread Tedd Sperling
On May 24, 2012, at 8:37 AM, Steven Staples wrote: > Tedd, > > I think the length of code depends on a few different factors, what if you > have your docblocks, and comment lines, as well as your bracing style? > Where do you consider your function to start? It starts where it starts. It doesn't

Re: [PHP] Function size

2012-05-24 Thread Tedd Sperling
On May 23, 2012, at 3:49 PM, Ashley Sheridan wrote: > > I'm of the same mind. Generally I'll split a function if I'm reusing more > than a couple of lines of code. I only split a "large" function if it's > actually doing several things, if it happens to need 200 lines to perform one > 'step' t

Re: [PHP] Function size

2012-05-24 Thread Jeremiah Dodds
"Steven Staples" writes: >> My monitor can also display about 55 lines of code, my functions are, on >> average, just a few lines of code though -- a maximum of about 20, with an >> average of around 5 or so. >> >> This is because the rule of thumb I follow is that a function should do > one >>

RE: [PHP] Function size

2012-05-24 Thread Steven Staples
> My monitor can also display about 55 lines of code, my functions are, on > average, just a few lines of code though -- a maximum of about 20, with an > average of around 5 or so. > > This is because the rule of thumb I follow is that a function should do one > thing, and should be named well. Th

Re: [PHP] Function size

2012-05-24 Thread Matijn Woudt
On Wed, May 23, 2012 at 10:14 PM, shiplu wrote: > > > On Thu, May 24, 2012 at 1:56 AM, Matijn Woudt wrote: >> >> I agree that large switch block are not always easy and useful to split, >> however, writing too much code inside a switch block isn't considered good >> practice too IMO. Though, it i

Re: [PHP] Function size

2012-05-23 Thread Jeremiah Dodds
Tedd Sperling writes: > It would be an interesting survey to ask programmers to review their code and > provide the average number of lines in their functions AND how many lines of > code their monitor's can display. In other words, look at your editor; count > the > number of lines your monitor

Re: [PHP] Function size

2012-05-23 Thread Camilo Sperberg
I use a lot of switches but they are always small in size because they look mostly like this: switch($action) { case 'hello': $someObject->executeAction(); break; case 'world': $someOtherObject->executeOtherAction(); break; default: $this->anotherAction(); break; }

Re: [PHP] Function size

2012-05-23 Thread shiplu
On Thu, May 24, 2012 at 1:56 AM, Matijn Woudt wrote: > I agree that large switch block are not always easy and useful to split, > however, writing too much code inside a switch block isn't considered good > practice too IMO. Though, it is unavoidable in some cases I think. I do > have some of the

Re: [PHP] Function size

2012-05-23 Thread Matijn Woudt
On Wed, May 23, 2012 at 9:49 PM, Ashley Sheridan wrote: > ** > On Wed, 2012-05-23 at 20:59 +0200, Matijn Woudt wrote: > > On Wed, May 23, 2012 at 5:49 PM, shiplu wrote: > > On Wed, May 23, 2012 at 8:14 PM, Tedd Sperling wrote: > > > >> Hi gang: > >> > >> On May 21, 2012, at 8:32 PM, tamouse mail

Re: [PHP] Function size

2012-05-23 Thread Ashley Sheridan
On Wed, 2012-05-23 at 20:59 +0200, Matijn Woudt wrote: > On Wed, May 23, 2012 at 5:49 PM, shiplu wrote: > > On Wed, May 23, 2012 at 8:14 PM, Tedd Sperling wrote: > > > >> Hi gang: > >> > >> On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote: > >> > A rule of thumb is no more than 50 lines

Re: [PHP] Function size

2012-05-23 Thread Tedd Sperling
On May 23, 2012, at 12:21 PM, Robert Cummings wrote: > On 12-05-23 12:15 PM, Tedd Sperling wrote: >> What I was talking about was that what we can grasp in one view, we can >> understand better. If the code lies outside of our view, then we understand >> it less. I can support this claim with num

Re: [PHP] Function size

2012-05-23 Thread Matijn Woudt
On Wed, May 23, 2012 at 5:49 PM, shiplu wrote: > On Wed, May 23, 2012 at 8:14 PM, Tedd Sperling wrote: > >> Hi gang: >> >> On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote: >> >  A rule of thumb is no more than 50 lines per >> > function, most much less. Back in the day when we didn't hav

Re: [PHP] Function size

2012-05-23 Thread Robert Cummings
On 12-05-23 12:15 PM, Tedd Sperling wrote: On May 23, 2012, at 11:49 AM, shiplu wrote: On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote: When number of lines becomes the criteria of function size? Wouldn't it depends on the task the function is doing? You missed the point. Of course

Re: [PHP] Function size

2012-05-23 Thread Tedd Sperling
On May 23, 2012, at 11:49 AM, shiplu wrote: > On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote: > When number of lines becomes the criteria of function size? Wouldn't it > depends on the task the function is doing? You missed the point. Of course, the difficulty of the task of a specif

Re: [PHP] Function size

2012-05-23 Thread shiplu
On Wed, May 23, 2012 at 8:14 PM, Tedd Sperling wrote: > Hi gang: > > On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote: > > A rule of thumb is no more than 50 lines per > > function, most much less. Back in the day when we didn't have nifty > > gui screens and an 24 line terminals (yay gr

Re: [PHP] function

2012-05-04 Thread tamouse mailing lists
On Thu, May 3, 2012 at 9:12 PM, Ron Piggott wrote: > I need to access a FUNCTION I programmed within a different FUNCTION.  Are > these able to be passed like a variable?  Or are they able to become like a > $_SESSION variable in nature?  How am I able to do this? > > I am essentially programmin

Re: [PHP] function

2012-05-04 Thread tamouse mailing lists
On Fri, May 4, 2012 at 9:18 PM, Jim Giner wrote: > But the OP says "function is defined inside a different function".  Your > theories to a solution don't fit that problem. [snip] > But the OP says "function is defined inside a different function".  Your > theories to a solution don't fit that pro

Re: [PHP] function

2012-05-04 Thread Jim Giner
But the OP says "function is defined inside a different function". Your theories to a solution don't fit that problem. "tamouse mailing lists" wrote in message news:cahuc_t-416_-lpcn3mo8qqxwrh4pnq5fmwouhwpdk+hmkgh...@mail.gmail.com... On Thu, May 3, 2012 at 9:12 PM, Ron Piggott wrote: Where i

Re: [PHP] function

2012-05-04 Thread tamouse mailing lists
On Thu, May 3, 2012 at 9:12 PM, Ron Piggott wrote: > I need to access a FUNCTION I programmed within a different FUNCTION.  Are > these able to be passed like a variable?  Or are they able to become like a > $_SESSION variable in nature?  How am I able to do this? > > I am essentially programmin

Re: [PHP] function

2012-05-03 Thread Simon Schick
On Fri, May 4, 2012 at 4:29 AM, Dan Joseph wrote: > > Are these inside classes or anything?  If they're just functions, they > should work fine together, example of 2 working functions together: > > > hellotwo(); > > function helloone() > { >        echo "hi 1"; > } > > function hellotwo() > { >

Re: [PHP] function

2012-05-03 Thread Dan Joseph
On Thu, May 3, 2012 at 10:12 PM, Ron Piggott wrote: > I need to access a FUNCTION I programmed within a different FUNCTION. Are > these able to be passed like a variable? Or are they able to become like a > $_SESSION variable in nature? How am I able to do this? > > I am essentially programmin

Re: [PHP] Function mktime() documentation question

2012-03-12 Thread Ashley Sheridan
On Mon, 2012-03-12 at 15:53 -0400, Tedd Sperling wrote: > On Mar 11, 2012, at 3:10 PM, Matijn Woudt wrote: > > On Sun, Mar 11, 2012 at 7:33 PM, Tedd Sperling > > wrote: > >> Actually, this works for me: > >> > >> $days_in_month = date('t', mktime(0, 0, 0, $next_month, 0, $year)); > >> > >> But

Re: [PHP] Function mktime() documentation question

2012-03-12 Thread Tedd Sperling
On Mar 11, 2012, at 3:10 PM, Matijn Woudt wrote: > On Sun, Mar 11, 2012 at 7:33 PM, Tedd Sperling > wrote: >> Actually, this works for me: >> >> $days_in_month = date('t', mktime(0, 0, 0, $next_month, 0, $year)); >> >> But again, I don't see why I have to use "next month" to find the number of

Re: [PHP] Function mktime() documentation question

2012-03-11 Thread Matijn Woudt
On Sun, Mar 11, 2012 at 7:33 PM, Tedd Sperling wrote: > On Mar 11, 2012, at 6:12 AM, Ashley Sheridan wrote: >> >> I still don't see what's wrong with >> >> date("t"); >> >> -- >> Thanks, >> Ash > > Ash: > > It's just too damn simple -- we need to make things complicated. :-) > > Actually, this wor

Re: [PHP] Function mktime() documentation question

2012-03-11 Thread Tedd Sperling
On Mar 11, 2012, at 6:12 AM, Ashley Sheridan wrote: > > I still don't see what's wrong with > > date("t"); > > -- > Thanks, > Ash Ash: It's just too damn simple -- we need to make things complicated. :-) Actually, this works for me: $days_in_month = date('t', mktime(0, 0, 0, $next_month, 0,

Re: [PHP] Function mktime() documentation question

2012-03-11 Thread Ashley Sheridan
On Sat, 2012-03-10 at 20:38 -0500, Tedd Sperling wrote: > On Mar 10, 2012, at 12:20 PM, Maciek Sokolewicz wrote: > > > function getAmountOfDaysInAMonth($month, $year) { > > $days = array(31, (($year%4==0 and ($year%100 > 0 or $year%400==0)) ? 29 > > : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 3

Re: [PHP] Function mktime() documentation question

2012-03-10 Thread Tedd Sperling
On Mar 10, 2012, at 12:20 PM, Maciek Sokolewicz wrote: > function getAmountOfDaysInAMonth($month, $year) { > $days = array(31, (($year%4==0 and ($year%100 > 0 or $year%400==0)) ? 29 : > 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); > return $days[$month+1]; > } I like that -- here's a small

Re: [PHP] Function mktime() documentation question

2012-03-10 Thread Matijn Woudt
On Sat, Mar 10, 2012 at 9:47 PM, tamouse mailing lists wrote: > I'm just a bit baffled why this isn't a standard library function. Good question, but I think the problem here is that there are tons of these small functions, and you got to make a choice on what to implement and what not. I can thi

Re: [PHP] Function mktime() documentation question

2012-03-10 Thread tamouse mailing lists
I'm just a bit baffled why this isn't a standard library function. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Function mktime() documentation question

2012-03-10 Thread Maciek Sokolewicz
On 10 March 2012 19:06, Matijn Woudt wrote: > On Sat, Mar 10, 2012 at 6:20 PM, Maciek Sokolewicz > wrote: > > On 09-03-2012 14:11, Daniel Brown wrote: > >> > >> (To the list, as well. First day with my new fingers, > apparently) > >> > >> On Fri, Mar 9, 2012 at 08:09, Daniel Brown wrot

Re: [PHP] Function mktime() documentation question

2012-03-10 Thread Matijn Woudt
On Sat, Mar 10, 2012 at 6:20 PM, Maciek Sokolewicz wrote: > On 09-03-2012 14:11, Daniel Brown wrote: >> >>     (To the list, as well.  First day with my new fingers, apparently) >> >> On Fri, Mar 9, 2012 at 08:09, Daniel Brown  wrote: >>> >>> On Thu, Mar 8, 2012 at 21:23, Tedd Sperling >>>  wr

Re: [PHP] Function mktime() documentation question

2012-03-10 Thread Maciek Sokolewicz
On 09-03-2012 14:11, Daniel Brown wrote: (To the list, as well. First day with my new fingers, apparently) On Fri, Mar 9, 2012 at 08:09, Daniel Brown wrote: On Thu, Mar 8, 2012 at 21:23, Tedd Sperling wrote: This starts getting a bit off-topic from your original email, but know

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Tedd Sperling
On Mar 9, 2012, at 12:52 PM, Charles wrote: > On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling > wrote: >> >> Well no, I don't need to know the first day of next month to know the last >> day of this month. That's like saying "I need to know who is going to stand >> at the 'end of the line' NEX

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Charles
On Sat, Mar 10, 2012 at 12:57 AM, Charles wrote: > On Sat, Mar 10, 2012 at 12:52 AM, Charles wrote: >> On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling >> wrote: >>> On Mar 9, 2012, at 11:17 AM, Charles wrote: >>> On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling wrote: > On Mar 9,

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Ashley Sheridan
Charles wrote: >On Sat, Mar 10, 2012 at 12:52 AM, Charles wrote: >> On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling > wrote: >>> On Mar 9, 2012, at 11:17 AM, Charles wrote: >>> On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling > wrote: > On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote:

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Charles
On Sat, Mar 10, 2012 at 12:52 AM, Charles wrote: > On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling > wrote: >> On Mar 9, 2012, at 11:17 AM, Charles wrote: >> >>> On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling >>> wrote: On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote: >> From: Tedd Sperl

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Charles
On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling wrote: > On Mar 9, 2012, at 11:17 AM, Charles wrote: > >> On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling >> wrote: >>> On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote: > From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] > But why does anyon

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Tedd Sperling
On Mar 9, 2012, at 11:17 AM, Charles wrote: > On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling > wrote: >> On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote: From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] But why does anyone have to use the next month to figure out how many days th

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Charles
On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling wrote: > On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote: >>> From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] >>> But why does anyone have to use the next month to figure out how >>> many days there are are in this month? Do you see my point? >> >>

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Tedd Sperling
On Mar 9, 2012, at 5:37 AM, Ford, Mike wrote: >> From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] >> But why does anyone have to use the next month to figure out how >> many days there are are in this month? Do you see my point? > > Actually, no. To figure this out, somewhere along the line yo

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Daniel Brown
(To the list, as well. First day with my new fingers, apparently) On Fri, Mar 9, 2012 at 08:09, Daniel Brown wrote: > On Thu, Mar 8, 2012 at 21:23, Tedd Sperling wrote: > >    This starts getting a bit off-topic from your original email, but > knowing that you're trying to use it for te

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Lester Caine
Ford, Mike wrote: Side-point: I find it interesting that getdate() has all sorts of > neat descriptions for the current month (such as, what weekday a > numbered day is), but lacks how many days are in the month. Doesn't > that seem odd? Now that's a decent point: I can see where you're comin

RE: [PHP] Function mktime() documentation question

2012-03-09 Thread Ford, Mike
> -Original Message- > From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] > Sent: 08 March 2012 23:15 > To: PHP-General List [previous discussion snipped] > Mike: > > Very well put. > > You say: > > > Huh? The 0th day of next month *is* the last day of the current > month, > > whi

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Charles
On Fri, Mar 9, 2012 at 9:23 AM, Tedd Sperling wrote: > On Mar 8, 2012, at 6:53 PM, Daniel Brown wrote: > On Mar 8, 2012 6:14 PM, "Tedd Sperling" wrote: >> >> > Side-point: I find it interesting that getdate() has all sorts of neat >> > descriptions for the current month (such as, what weekday a

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Tedd Sperling
On Mar 8, 2012, at 6:53 PM, Daniel Brown wrote: On Mar 8, 2012 6:14 PM, "Tedd Sperling" wrote: > > > Side-point: I find it interesting that getdate() has all sorts of neat > > descriptions for the current month (such as, what weekday a numbered day > > is), but lacks how many days are in the mo

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Jim Lucas
On 03/08/2012 04:44 PM, Jim Lucas wrote: On 03/08/2012 04:31 PM, Jim Lucas wrote: On 03/08/2012 04:24 PM, Jim Lucas wrote: On 03/08/2012 03:14 PM, Tedd Sperling wrote: On Mar 8, 2012, at 11:20 AM, Ford, Mike wrote: -Original Message- From: Tedd Sperling [mailto:tedd.sperl...@gmail.com

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Jim Lucas
On 03/08/2012 04:31 PM, Jim Lucas wrote: On 03/08/2012 04:24 PM, Jim Lucas wrote: On 03/08/2012 03:14 PM, Tedd Sperling wrote: On Mar 8, 2012, at 11:20 AM, Ford, Mike wrote: -Original Message- From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] From my code, the number of days in a mo

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Jim Lucas
On 03/08/2012 04:24 PM, Jim Lucas wrote: On 03/08/2012 03:14 PM, Tedd Sperling wrote: On Mar 8, 2012, at 11:20 AM, Ford, Mike wrote: -Original Message- From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] From my code, the number of days in a month can be found by using 0 as the first i

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Jim Lucas
On 03/08/2012 03:14 PM, Tedd Sperling wrote: On Mar 8, 2012, at 11:20 AM, Ford, Mike wrote: -Original Message- From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] From my code, the number of days in a month can be found by using 0 as the first index of the next month -- not the last da

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Daniel Brown
On Mar 8, 2012 6:14 PM, "Tedd Sperling" wrote: > > On Mar 8, 2012, at 11:20 AM, Ford, Mike wrote: > >> -Original Message- > >> From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] > >> From my code, the number of days in a month can be found by using 0 > >> as the first index of the next m

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Tedd Sperling
On Mar 8, 2012, at 11:20 AM, Ford, Mike wrote: >> -Original Message- >> From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] >> From my code, the number of days in a month can be found by using 0 >> as the first index of the next month -- not the last day of the >> previous month. > > Huh?

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Tedd Sperling
On Mar 7, 2012, at 4:28 PM, Daniel Brown wrote: > On Wed, Mar 7, 2012 at 15:03, Tedd Sperling wrote: >> Hi gang: >> >> I am using the getdate(mktime()) functions to get month data (i.e., name of >> month, first weekday, last day, number of days). >> >> To get the number of days for a specific

Re: [PHP] Function mktime() documentation question

2012-03-07 Thread Charles
On Thu, Mar 8, 2012 at 7:01 AM, Simon Schick wrote: > $date = new DateTime($year . '-' . $current_month . '-1'); > $date->add( new DateInterval( 'P1M' ) ); // Add a period of 1 month to > the date-instance (haven't tried that with the 30th of Jan ... would > be kind-of interesting) > > $days_in_cu

Re: [PHP] Function mktime() documentation question

2012-03-07 Thread Simon Schick
Hi, All To bring a work-around into this discussion I myself would not see it as a good way to do it like that - even if the documentation provides some information around that. Here's what I have done in all new projects I worked with time-calculation: @Tedd: Lets pick up your first example and

Re: [PHP] Function mktime() documentation question

2012-03-07 Thread shiplu
> To get the number of days for a specific month, I use: > > // $current_month is the month under question > > $next_month = $current_month + 1; I use this $next_month = $current_month + 1; $next_month_1= mktime(0, 0, 0, $next_month, 1, date("Y") ); $current_month_1= mktime(0, 0, 0, $curr

Re: [PHP] Function mktime() documentation question

2012-03-07 Thread Daniel Brown
On Wed, Mar 7, 2012 at 15:03, Tedd Sperling wrote: > Hi gang: > > I am using the getdate(mktime()) functions to get month data (i.e., name of > month, first weekday, last day, number of days). > > To get the number of days for a specific month, I use: > > // $current_month is the month under ques

RE: [PHP] Function mktime() documentation question

2012-03-07 Thread admin
Tedd, This area was always a little grey to me. I have used -1 to obtain the previous months for some time now. 0 always indicated the beginning index of the current month but the explanation never seemed to fit the bill. Having worked extensively in time manipulation in many of the deve

Re: [PHP] Function links on error and warningmessages

2012-02-03 Thread Matijn Woudt
On Fri, Feb 3, 2012 at 4:35 PM, Ford, Mike wrote: >> -Original Message- >> From: Florian Müller [mailto:florip...@hotmail.com] >> Sent: 03 February 2012 14:36 >> >> Hi guys, >> >> I was wondering some time ago, why the links which are shown on >> error or warning (E_WARNING etc.) show rela

RE: [PHP] Function links on error and warningmessages

2012-02-03 Thread Ford, Mike
> -Original Message- > From: Florian Müller [mailto:florip...@hotmail.com] > Sent: 03 February 2012 14:36 > > Hi guys, > > I was wondering some time ago, why the links which are shown on > error or warning (E_WARNING etc.) show relative links to an usually > non-existing file. Because yo

Re: [PHP] function exists in command line but not in browser

2010-07-19 Thread Richard Quadling
On 19 July 2010 10:04, Nilesh Govindarajan wrote: > On Mon, Jul 19, 2010 at 2:22 PM, Shelley wrote: >> Hi all, >> >> The problem is imagettfbbox(). >> jpgraph uses it to create truetype font images. >> >> I have a phpinfo() script. >> >> The command line output: >> >> php i.php | grep Free >> Fre

Re: [PHP] function exists in command line but not in browser

2010-07-19 Thread Nilesh Govindarajan
On Mon, Jul 19, 2010 at 2:22 PM, Shelley wrote: > Hi all, > > The problem is imagettfbbox(). > jpgraph uses it to create truetype font images. > > I have a phpinfo() script. > > The command line output: > > php i.php | grep Free > FreeType Support => enabled > FreeType Linkage => with freetype > F

Re: [PHP] function within a class function

2010-06-21 Thread Richard Quadling
On 21 June 2010 00:45, Rick Pasotto wrote: > Within a class function I have defined another function for use with the > usort() function. How do I reference it? > > When it's not part of a class usort($arr,"cmp") works fine but when it's > within a class function I get this error: > > PHP Parse er

Re: [PHP] function within a class function

2010-06-20 Thread Rick Pasotto
On Sun, Jun 20, 2010 at 08:47:53PM -0400, Brandon Rampersad wrote: > $this->usort(); > self::usort(); > > On Sun, Jun 20, 2010 at 7:45 PM, Rick Pasotto wrote: > > > Within a class function I have defined another function for use with the > > usort() function. How do I reference it? > > > > When

Re: [PHP] function/class to convert IDN (Puny-Code)?

2010-05-13 Thread tedd
At 4:51 AM +0200 5/13/10, Michelle Konzack wrote: Hello, while reading RFC3490 (plus 3454/3491/3492) and before I am ongoing to reinvent the wheel here the question: Does someone HAVE or know a function/class which does the IDN conversion "toASCII" and "toUNICODE"? Note: The C Sour

Re: [PHP] function not returning query

2009-11-25 Thread Philip Thompson
On Nov 25, 2009, at 4:32 AM, Ashley Sheridan wrote: > On Tue, 2009-11-24 at 23:27 -0800, Allen McCabe wrote: > >> If I were to loop through my inputs, I could just exclude any >> problematic names, eg.: >> >> foreach ($_POST as $var = $val) >> { >> if ($var != filter.x || $var != filter.y) >>

Re: [PHP] function not returning query

2009-11-25 Thread Ashley Sheridan
On Tue, 2009-11-24 at 23:27 -0800, Allen McCabe wrote: > If I were to loop through my inputs, I could just exclude any > problematic names, eg.: > > foreach ($_POST as $var = $val) > { >if ($var != filter.x || $var != filter.y) > { > $var = $val; > } > } > > Like that? > > > On Tue

Re: [PHP] function not returning query

2009-11-24 Thread Ashley Sheridan
On Tue, 2009-11-24 at 02:11 -0800, Allen McCabe wrote: > I am! Will these extra query variables cause any problems or should I > use standard submit inputs? > > Thanks Ashley! > > > On Tue, Nov 24, 2009 at 1:10 AM, Ashley Sheridan > wrote: > > > On Mon, 2009-11-23 at 21:53 -0

Re: [PHP] function not returning query

2009-11-24 Thread Ashley Sheridan
On Mon, 2009-11-23 at 21:53 -0800, Allen McCabe wrote: > Okay, suddenly I got it to filter the results, but I still can't figure out > where this part of the query is coming from, at the end of the query string > in the URL, I have this "filter.x=0&filter.y=0". > > No where in my form do I have a

Re: [PHP] function not returning query

2009-11-23 Thread Allen McCabe
Okay, suddenly I got it to filter the results, but I still can't figure out where this part of the query is coming from, at the end of the query string in the URL, I have this "filter.x=0&filter.y=0". No where in my form do I have a field named filter.x or filter.y. I DO however, have 3 forms (I d

Re: [PHP] function not returning query

2009-11-23 Thread Philip Thompson
On Nov 23, 2009, at 6:22 PM, Allen McCabe wrote: > Hi, thanks for reading, I hope you can help: > > In my main file for an orders page I have the following code: > > > if (isset($_GET['filterby'])) > { > $resultOrders = adminFilterQuery(); > $numberOfOrders = mysql_num_rows($resultOrders); >

Re: [PHP] function not returning query

2009-11-23 Thread Phpster
Likely your query failed due to an error. Try adding an or die(mysql_error()) to the end of your mysql_query statement to see what that error maybe Bastien Sent from my iPod On Nov 23, 2009, at 7:22 PM, Allen McCabe wrote: Hi, thanks for reading, I hope you can help: In my main file for

[PHP] Re: PHP function unpack

2009-10-15 Thread Gabriel Hahmann
Hi, I've sent this mail a few days ago, but as this list have a very high traffic maybe my mail disappear from you inbox. Any help would be appreciated. Thanks in advance, Gabriel. On Sun, Oct 11, 2009 at 4:42 PM, Gabriel Hahmann wrote: > Hi, > > I'm new to the list and I've search internet an

Re: [PHP] Function parameter passed by reference with default value to null

2009-07-06 Thread David Otton
2009/7/6 Lupus Michaelis : > > David Otton a écrit : > >> So there's some serious impedance mismatch going on there to make both >> features to work together. Just think of the default value as >> "something I can overwrite", eg: > >  Thanks for this smart explanation. It shines my day. np. On ref

Re: [PHP] Function parameter passed by reference with default value to null

2009-07-06 Thread Lupus Michaelis
David Otton a écrit : So there's some serious impedance mismatch going on there to make both features to work together. Just think of the default value as "something I can overwrite", eg: Thanks for this smart explanation. It shines my day. -- Mickaël Wolff aka Lupus Michaelis http://lupusm

Re: [PHP] Function parameter passed by reference with default value to null

2009-07-06 Thread David Otton
2009/7/6 Lupus Michaelis : >  I'm happy PHP raises an error on foo(null) ; >  I'm in trouble when foo() doesn't. > >  The actual question is : why PHP doesn't raise an error ? This functionality (default values for passed-by-reference parameters) was added in PHP5. The problem is that you can't

Re: [PHP] Function parameter passed by reference with default value to null

2009-07-06 Thread Lupus Michaelis
Stuart a écrit : The whole point of default arguments is for it to use that argument if none is passed. It is not the point too. What makes you think not passing an argument to that function should raise an error? Maybe because in my example, the provided value is not a valuable value fo

Re: [PHP] Function parameter passed by reference with default value to null

2009-07-06 Thread Stuart
2009/7/6 Lupus Michaelis : > Stuart a écrit : > >> You appear to be using the definition of null that comes from the >> world of C. > >  I didn't. The point is I'm allowed to set a default value to null for a > referenced parameter (what I can do in C for a pointer, so I knew it). > >  I'm happy PH

Re: [PHP] Function parameter passed by reference with default value to null

2009-07-06 Thread Lupus Michaelis
Stuart a écrit : You appear to be using the definition of null that comes from the world of C. I didn't. The point is I'm allowed to set a default value to null for a referenced parameter (what I can do in C for a pointer, so I knew it). I'm happy PHP raises an error on foo(null) ; I'

Re: [PHP] Function parameter passed by reference with default value to null

2009-07-06 Thread Stuart
2009/7/6 Lupus Michaelis : >  Hi, > >  I would like to know if I am alone to be shoked by this : > > == 8< == > function foo(& $bar = null) > { > } > > foo() ; // runs > foo(null) ; // raise an error > == >8 == > >  Why the default value to null for a reference is allowed ? Is it a bug, a > feature

Re: [PHP] function array problem

2009-02-18 Thread Ashley Sheridan
On Wed, 2009-02-18 at 10:21 -0600, Shawn McKenzie wrote: > Thodoris wrote: > > > >> I've had a bit of a problem with a function I'm using for a form. > >> Essentially, the function looks like this: > >> > >> function addEvent($values = Array('name' => '', 'venue' => '', > >> 'description' => '', '

Re: [PHP] function array problem

2009-02-18 Thread Shawn McKenzie
Thodoris wrote: > >> I've had a bit of a problem with a function I'm using for a form. >> Essentially, the function looks like this: >> >> function addEvent($values = Array('name' => '', 'venue' => '', >> 'description' => '', 'errors' => Array())) >> { >> // code here displays the form >> } >>

Re: [PHP] function array problem

2009-02-18 Thread Thodoris
I've had a bit of a problem with a function I'm using for a form. Essentially, the function looks like this: function addEvent($values = Array('name' => '', 'venue' => '', 'description' => '', 'errors' => Array())) { // code here displays the form } The function is used to both display an

Re: [PHP] function array problem

2009-02-17 Thread Eric Butera
On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan wrote: > I've had a bit of a problem with a function I'm using for a form. > Essentially, the function looks like this: > > function addEvent($values = Array('name' => '', 'venue' => '', > 'description' => '', 'errors' => Array())) > { >// code

Re: [PHP] function array problem

2009-02-17 Thread Shawn McKenzie
Andrew Ballard wrote: > On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan > wrote: >> I've had a bit of a problem with a function I'm using for a form. >> Essentially, the function looks like this: >> >> function addEvent($values = Array('name' => '', 'venue' => '', >> 'description' => '', 'errors'

Re: [PHP] function array problem

2009-02-17 Thread Ashley Sheridan
On Tue, 2009-02-17 at 20:35 +, Lewis Wright wrote: > What about: > > > function addEvent($values='') > { > !is_array($values) && $values = Array('name' => '', 'venue' => '', > 'description' =>'', > 'errors' => Array()); > > //rest of the code > > } > > It's nice and sort. > > 2009/2/17 A

Re: [PHP] function array problem

2009-02-17 Thread Lewis Wright
What about: function addEvent($values='') { !is_array($values) && $values = Array('name' => '', 'venue' => '', 'description' =>'', 'errors' => Array()); //rest of the code } It's nice and sort. 2009/2/17 Ashley Sheridan : > On Tue, 2009-02-17 at 15:21 -0500, Andrew Ballard wrote: >> On Tue,

Re: [PHP] function array problem

2009-02-17 Thread Ashley Sheridan
On Tue, 2009-02-17 at 15:21 -0500, Andrew Ballard wrote: > On Tue, Feb 17, 2009 at 3:29 PM, Ashley Sheridan > wrote: > > On Tue, 2009-02-17 at 15:13 -0500, Bastien Koert wrote: > >> On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan > >> wrote: > >> > >> > I've had a bit of a problem with a function

Re: [PHP] function array problem

2009-02-17 Thread Ashley Sheridan
On Tue, 2009-02-17 at 15:19 -0500, Andrew Ballard wrote: > On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan > wrote: > > I've had a bit of a problem with a function I'm using for a form. > > Essentially, the function looks like this: > > > > function addEvent($values = Array('name' => '', 'venue'

Re: [PHP] function array problem

2009-02-17 Thread Andrew Ballard
On Tue, Feb 17, 2009 at 3:29 PM, Ashley Sheridan wrote: > On Tue, 2009-02-17 at 15:13 -0500, Bastien Koert wrote: >> On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan >> wrote: >> >> > I've had a bit of a problem with a function I'm using for a form. >> > Essentially, the function looks like this:

Re: [PHP] function array problem

2009-02-17 Thread Andrew Ballard
On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan wrote: > I've had a bit of a problem with a function I'm using for a form. > Essentially, the function looks like this: > > function addEvent($values = Array('name' => '', 'venue' => '', > 'description' => '', 'errors' => Array())) > { >// code

Re: [PHP] function array problem

2009-02-17 Thread Ashley Sheridan
On Tue, 2009-02-17 at 15:13 -0500, Bastien Koert wrote: > On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan > wrote: > > > I've had a bit of a problem with a function I'm using for a form. > > Essentially, the function looks like this: > > > > function addEvent($values = Array('name' => '', 'venue'

Re: [PHP] function array problem

2009-02-17 Thread Bastien Koert
On Tue, Feb 17, 2009 at 3:10 PM, Ashley Sheridan wrote: > I've had a bit of a problem with a function I'm using for a form. > Essentially, the function looks like this: > > function addEvent($values = Array('name' => '', 'venue' => '', > 'description' => '', 'errors' => Array())) > { >// code

  1   2   3   4   5   6   >