Re: Have little enough hair as it is ...
| From: | Lester Caine | Date: | Mon, 12 Mar 2012 13:38:01 +0000 |
| Subject: | Re: Have little enough hair as it is ... | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-316992@lists.php.net to get a copy of this message | ||
Simon Schick wrote:
I suggest that all done with this variable before is not of interest ... Assuming this, I'd say the following: $secondsGap[] = array($gap[0] * 60, $gap[1] * 60); Implicit initializing of an array that has the following structure: array( array(int, int) );OK $gap comes from the loop foreach(self::$timeGap as $gap) self::$timeGap is a list of pairs of numbers.
if( isset($secondsGap[1]) ) { Trying to get the second element .. which will never happen if you haven't added an element before the snipped you pasted here.-- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php$gapName = $secondsGap[0]."to".$secondsGap[1];} else {$gapName = $secondsGap[0];} [some-code] I'm quite unsure what you want to do here. If you'd update the first line as following it would always trigger the first condition: $secondsGap = array($gap[0] * 60, $gap[1] * 60); What this code is doing perfectly in PHP5.3 is generating the text string to display for each time period listed in the array of pairs of numbers ( some with a 'blank' second number and what the code returns is a string of the format '(number1)to(number2)' or simply '(number1)' - something fairly standard in PHP? But the nanny message says it need to be re-writen, the question is 'How?' :(