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 black!), if

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 factor in

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 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 functions

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 with

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 give an

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 function

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 t...@sperling.com wrote: H Yes, I think that is *exactly* the criterion-- not a mystery or an emergent thing, really, was a pretty

Re: [PHP] Function size

2012-05-24 Thread Matijn Woudt
On Wed, May 23, 2012 at 10:14 PM, shiplu shiplu@gmail.com wrote: On Thu, May 24, 2012 at 1:56 AM, Matijn Woudt tijn...@gmail.com 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

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. The

Re: [PHP] Function size

2012-05-24 Thread Jeremiah Dodds
Steven Staples sstap...@mnsi.net 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

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' then

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 make

[PHP] Function size

2012-05-23 Thread Tedd Sperling
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 black!), if a function exceeded one printed page, it was

Re: [PHP] Function size

2012-05-23 Thread shiplu
On Wed, May 23, 2012 at 8:14 PM, Tedd Sperling t...@sperling.com 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

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 specific

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

Re: [PHP] Function size

2012-05-23 Thread Matijn Woudt
On Wed, May 23, 2012 at 5:49 PM, shiplu shiplu@gmail.com wrote: On Wed, May 23, 2012 at 8:14 PM, Tedd Sperling t...@sperling.com 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

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 numerous

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 shiplu@gmail.com wrote: On Wed, May 23, 2012 at 8:14 PM, Tedd Sperling t...@sperling.com wrote: Hi gang: On May 21, 2012, at 8:32 PM, tamouse mailing lists wrote: A rule of thumb is

Re: [PHP] Function size

2012-05-23 Thread Matijn Woudt
On Wed, May 23, 2012 at 9:49 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: ** On Wed, 2012-05-23 at 20:59 +0200, Matijn Woudt wrote: On Wed, May 23, 2012 at 5:49 PM, shiplu shiplu@gmail.com wrote: On Wed, May 23, 2012 at 8:14 PM, Tedd Sperling t...@sperling.com wrote: Hi gang:

Re: [PHP] Function size

2012-05-23 Thread shiplu
On Thu, May 24, 2012 at 1:56 AM, Matijn Woudt tijn...@gmail.com 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

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 Jeremiah Dodds
Tedd Sperling t...@sperling.com 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

Re: [PHP] function

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

Re: [PHP] function

2012-05-04 Thread tamouse mailing lists
On Thu, May 3, 2012 at 9:12 PM, Ron Piggott ron.pigg...@actsministries.org 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

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 tamouse.li...@gmail.com wrote in message news:cahuc_t-416_-lpcn3mo8qqxwrh4pnq5fmwouhwpdk+hmkgh...@mail.gmail.com... On Thu, May 3, 2012 at 9:12 PM, Ron

Re: [PHP] function

2012-05-04 Thread tamouse mailing lists
On Fri, May 4, 2012 at 9:18 PM, Jim Giner jim.gi...@albanyhandball.com 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

Re: [PHP] function

2012-05-04 Thread tamouse mailing lists
On Thu, May 3, 2012 at 9:12 PM, Ron Piggott ron.pigg...@actsministries.org 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

[PHP] function

2012-05-03 Thread Ron Piggott
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 programming: === function name( $flag1, $flag2 ) { # some PHP

Re: [PHP] function

2012-05-03 Thread Dan Joseph
On Thu, May 3, 2012 at 10:12 PM, Ron Piggott ron.pigg...@actsministries.org 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?

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 tedd.sperl...@gmail.com 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

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 tedd.sperl...@gmail.com wrote: Actually, this works for me: $days_in_month = date('t', mktime(0, 0, 0, $next_month, 0, $year));

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, 31);

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, $year));

Re: [PHP] Function mktime() documentation question

2012-03-11 Thread Matijn Woudt
On Sun, Mar 11, 2012 at 7:33 PM, Tedd Sperling tedd.sperl...@gmail.com 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

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 Browndanbr...@php.net wrote: On Thu, Mar 8, 2012 at 21:23, Tedd Sperlingtedd.sperl...@gmail.com wrote: This starts getting a bit

Re: [PHP] Function mktime() documentation question

2012-03-10 Thread Matijn Woudt
On Sat, Mar 10, 2012 at 6:20 PM, Maciek Sokolewicz maciek.sokolew...@gmail.com 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 Browndanbr...@php.net  wrote: On Thu, Mar 8, 2012 at

Re: [PHP] Function mktime() documentation question

2012-03-10 Thread Maciek Sokolewicz
On 10 March 2012 19:06, Matijn Woudt tijn...@gmail.com wrote: On Sat, Mar 10, 2012 at 6:20 PM, Maciek Sokolewicz maciek.sokolew...@gmail.com 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

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 Matijn Woudt
On Sat, Mar 10, 2012 at 9:47 PM, tamouse mailing lists tamouse.li...@gmail.com 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

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-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, which gives you

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 coming

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 danbr...@php.net wrote: On Thu, Mar 8, 2012 at 21:23, Tedd Sperling tedd.sperl...@gmail.com wrote:    This starts getting a bit off-topic from your original email, but knowing

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 you've

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Charles
On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling tedd.sperl...@gmail.com 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

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 tedd.sperl...@gmail.com 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

Re: [PHP] Function mktime() documentation question

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

Fwd: [PHP] Function mktime() documentation question

2012-03-09 Thread Andrew Ballard
And again to the list, since for some reason Reply-to-all did not do as intended this time. -- Forwarded message -- From: Andrew Ballard aball...@gmail.com Date: Fri, Mar 9, 2012 at 12:53 PM Subject: Re: [PHP] Function mktime() documentation question To: Tedd Sperling tedd.sperl

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Charles
On Sat, Mar 10, 2012 at 12:52 AM, Charles peac...@gmail.com wrote: On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Mar 9, 2012, at 11:17 AM, Charles wrote: On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Mar 9, 2012, at

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Ashley Sheridan
Charles peac...@gmail.com wrote: On Sat, Mar 10, 2012 at 12:52 AM, Charles peac...@gmail.com wrote: On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Mar 9, 2012, at 11:17 AM, Charles wrote: On Fri, Mar 9, 2012 at 10:58 PM, Tedd Sperling

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Charles
On Sat, Mar 10, 2012 at 12:57 AM, Charles peac...@gmail.com wrote: On Sat, Mar 10, 2012 at 12:52 AM, Charles peac...@gmail.com wrote: On Sat, Mar 10, 2012 at 12:07 AM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Mar 9, 2012, at 11:17 AM, Charles wrote: On Fri, Mar 9, 2012 at 10:58 PM,

Re: [PHP] Function mktime() documentation question

2012-03-09 Thread Tedd Sperling
second in the month. Besides, showing how it is done is part of education. Arrggg. When I said I, I meant I and not a php function. Sometimes the point is never made. tedd _ tedd.sperl...@gmail.com http://sperling.com -- PHP General Mailing List (http://www.php.net

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 tedd.sperl...@gmail.com 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

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? The 0th

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Daniel Brown
On Mar 8, 2012 6:14 PM, Tedd Sperling tedd.sperl...@gmail.com 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

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

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

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

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

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 tedd.sperl...@gmail.com 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

Re: [PHP] Function mktime() documentation question

2012-03-08 Thread Charles
On Fri, Mar 9, 2012 at 9:23 AM, Tedd Sperling tedd.sperl...@gmail.com wrote: On Mar 8, 2012, at 6:53 PM, Daniel Brown wrote: On Mar 8, 2012 6:14 PM, Tedd Sperling tedd.sperl...@gmail.com wrote: Side-point: I find it interesting that getdate() has all sorts of neat descriptions for the

[PHP] Function mktime() documentation question

2012-03-07 Thread Tedd Sperling
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 question $next_month = $current_month + 1; $what_date =

RE: [PHP] Function mktime() documentation question

2012-03-07 Thread admin
the days of any given month or just about anything you need to just use the strtotime $days_in_month = date('j',strtotime($this_month)); -Original Message- From: Tedd Sperling [mailto:tedd.sperl...@gmail.com] Sent: Wednesday, March 07, 2012 3:04 PM To: PHP-General List Subject: [PHP

Re: [PHP] Function mktime() documentation question

2012-03-07 Thread Daniel Brown
On Wed, Mar 7, 2012 at 15:03, Tedd Sperling tedd.sperl...@gmail.com 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

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,

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 Charles
On Thu, Mar 8, 2012 at 7:01 AM, Simon Schick simonsimc...@googlemail.com 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

[PHP] Function links on error and warningmessages

2012-02-03 Thread Florian Müller
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. Wouldn't it be much more useful if all errors are linking to the function description on php.net? So, if I get an error with

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 you

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 m.f...@leedsmet.ac.uk 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.)

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

2010-07-19 Thread Shelley
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 FreeType Version = 2.2.1 But when the script is loaded in the browser,

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 myphpl...@gmail.com 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

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 li...@itech7.com wrote: On Mon, Jul 19, 2010 at 2:22 PM, Shelley myphpl...@gmail.com 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 |

Re: [PHP] function within a class function

2010-06-21 Thread Richard Quadling
On 21 June 2010 00:45, Rick Pasotto r...@niof.net 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

[PHP] function within a class function

2010-06-20 Thread Rick Pasotto
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 error: syntax error, unexpected T_STRING, expecting

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 r...@niof.net wrote: Within a class function I have defined another function for use with the usort() function. How do I reference it? When

Re: [PHP] getaddrinfo() - what is the equivalent php function?

2010-05-27 Thread Per Jessen
Per Jessen wrote: AFAICT, gethostbyname() only works for ipv4 addresses, so that one is out - dns_get_record seems to be really for dns only, i.e. it does not look at /etc/hosts. Is there a hph function that essentially just calls getaddrinfo() ? Wow, lots of answers to that one. Let me

[PHP] getaddrinfo() - what is the equivalent php function?

2010-05-26 Thread Per Jessen
AFAICT, gethostbyname() only works for ipv4 addresses, so that one is out - dns_get_record seems to be really for dns only, i.e. it does not look at /etc/hosts. Is there a hph function that essentially just calls getaddrinfo() ? -- Per Jessen, Zürich (19.1°C) -- PHP General Mailing List

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

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

2010-05-12 Thread Michelle Konzack
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 Source-Code is included in RFC3492 and can more or

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, Nov 24, 2009

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) { $var =

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=0filter.y=0. No where in my form do I have a field

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 a...@ashleysheridan.co.uk wrote: On Mon,

[PHP] function not returning query

2009-11-23 Thread Allen McCabe
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); } else { $resultOrders = mysql_query(SELECT * FROM

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 allenmcc...@gmail.com wrote: Hi, thanks for reading, I hope you can

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); } else

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=0filter.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

[PHP] Function Not Working...Little help

2009-11-05 Thread Don Wieland
Hello, I am trying to get this function working but it gives me a PHP error (blank page): function Validate_Page_Nav($LastPage, $ErrorPage) { $trimmed = str_replace($staffroot, '', $_SERVER['SCRIPT_NAME']); $resul = $db-query(SELECT * FROM Page_Access WHERE URI = '$trimmed') or die(failed

[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 gabriel.hahm...@gmail.com wrote: Hi, I'm new to the list and

[PHP] PHP function unpack

2009-10-11 Thread Gabriel Hahmann
Hi, I'm new to the list and I've search internet and didn't find an answer to my problem. I'm converting a perl script to PHP and I've done almost everything. The only part of the code that I didn't get working on PHP was: (PERL CODE) foreach ($b_length,$b_mac,$b_crlf,$b_crlf,$a_body) {

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

2009-07-06 Thread 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 ? Thanks ! -- Mickaël Wolff aka Lupus

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

2009-07-06 Thread Stuart
2009/7/6 Lupus Michaelis mickael+...@lupusmic.org:  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

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) ;

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

2009-07-06 Thread Stuart
2009/7/6 Lupus Michaelis mickael+...@lupusmic.org: 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).

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

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

2009-07-06 Thread David Otton
2009/7/6 Lupus Michaelis mickael+...@lupusmic.org:  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

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

2009-07-06 Thread David Otton
2009/7/6 Lupus Michaelis mickael+...@lupusmic.org: 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.

  1   2   3   4   5   6   7   8   9   >