Re: Have little enough hair as it is ...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2012/3/12 Lester Caine <lester@xxxxxxxxxxx>:
> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux