1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

php version

Discussion in 'Off Topic' started by ragtek, Jan 12, 2011.

?

php version

  1. 5.2

    8 vote(s)
    26.7%
  2. 5.3

    22 vote(s)
    73.3%
  1. ragtek

    ragtek Guest

    Which php version are you using?

    Already php5.3 or 5.2 ?

    We made the decision to use the new features of php 5.3 for our add-ons, because it makes development "faster & easier"
    for example
    get_called_class()
    PHP:
    abstract class Ragtek_Helper_Abstract{

        static private 
    $instances = array();
        public static function 
    getInstance(){
            
    $class get_called_class();
            if (empty(
    self::$instances[$class]))
            {
                
    self::$instances[$class] = new $class;
            }
            return 
    self::$instances[$class];
        }
    }
    But i think that this will result in an big "problem" for many users, because they will not be able to use these add-ons.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Shared server so only 5.2.14 unfortunately.
     
  3. Ryan Ashbrook

    Ryan Ashbrook Active Member

    5.2.x (various different servers)
     
  4. Kier

    Kier XenForo Developer Staff Member

    5.3... mmm closures (allows you to write PHP like Javascript, bloody fantastic from time to time)
     
  5. ragtek

    ragtek Guest

    I've never seen a "useful real world php example" when to use closures (just used in in js), so i've never used them in my code, but I'm loving the late static binding.
     
  6. Pope Viper

    Pope Viper Well-Known Member

    Had to use 5.3 for my Ampache installation.
     
  7. Shamil

    Shamil Well-Known Member

    This.
     
  8. DSF

    DSF Well-Known Member

    PHP 5.2.4 Ubuntu
     
  9. CBI Web

    CBI Web Well-Known Member

    5.2.x for now, planning to go 5.3 soon as I know it won't break anything I'm doing.
     
  10. Mikey

    Mikey Well-Known Member

    mikey@aeon:~$ php -v
    PHP 5.2.4-2ubuntu5.12 with Suhosin-Patch 0.9.6.2 (cli) (built: Sep 20 2010 13:33:05)
    Copyright (c) 1997-2007 The PHP Group
    Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies
     
  11. a legacy reborn

    a legacy reborn Well-Known Member

  12. Indigo

    Indigo Active Member

    PHP:
    usort($array, function($a$b) {
        return 
    $a $b// or something, y'know, more complex.
    });
    $text preg_replace_callback('/\((\d+)\+(\d+)\)/', function($match) {
        return 
    '(' . ($match[1] + $match[2]) . ')';
    }, 
    '(2+3) (10+7)');
    // (5) (17) but i didn't test this at all.
    Basically anyplace you use a callback, you no longer need to write a one-shot function that only serves a single basic purpose. Unless you do the unthinkable and use... create_function.
     
    CBI Web likes this.

Share This Page