You are here: Re: Checking PHP version for compatibility? « PHP Programming Language « IT news, forums, messages
Re: Checking PHP version for compatibility?

Posted by Jerry Stuckle on 09/19/06 02:17

rustysmith@bellsouth.net wrote:
> Anyone know how to check the PHP version that a current file is
> running on? This would be helpful in the instance where you are trying
> to make a package that can be distributed publicly for use in a variety
> of configurations. This code should(?) work:
>
> $ver=PHP_VERSION;
> if(ereg('^[1-4]',$ver))
> $post_ids=array_flip(&$post_ids); // Old syntax
> else
> $post_ids=array_flip($post_ids); // PHP 5+ syntax
>
> but it still throws the error:
>
> Warning: Call-time pass-by-reference has been deprecated - argument
> passed by value; If you would like to pass it by reference, modify the
> declaration of array_flip(). If you would like to enable call-time
> pass-by-reference, you can set allow_call_time_pass_reference to true
> in your INI file. However, future versions may not support this any
> longer.
>
> When executed in PHP 5.+
>
> Thanks in advance for any ideas how to make this work?
>

That's because this is a compile-time notice, not a run-time one.

array_flip() does not take a reference to the array, it is expecting a
copy. So you should just use

$post_ids=array_flip($post_ids);

in either version.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация