Re: Have little enough hair as it is ...
| From: | Simon Schick | Date: | Mon, 12 Mar 2012 07:14:57 +0000 |
| Subject: | Re: Have little enough hair as it is ... | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-316991@lists.php.net to get a copy of this message | ||
2012/3/12 Lester Caine <lester@lsces.co.uk>:
> More irritating is
> 'Notice: Array to string conversion' which are coming up all over the place.
> I can understand what the problem is ... but trying to remove the notices is
> more challenging ...
>
> $secondsGap[] = array($gap[0] * 60, $gap[1] * 60);
> if( isset($secondsGap[1]) ) {
> $gapName = $secondsGap[0]."to".$secondsGap[1];
> } else {
> $gapName = $secondsGap[0];
> }
> $secondsGap[] is two numbers, which are used to create the name string, so
> what is the 'official' way of making this work without generating warnings?
>
Hi, Lester
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) );
> 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.
> $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);
Bye
Simon