Kadir Özdemir

  • Ben Kimim
  • PHP
  • Sencha Touch
  • Home/
  • PHP /
  • Php 5.4 yayinlandi

Php 5.4 yayinlandi

Skorp 02.03.2012 Comments Off on Php 5.4 yayinlandi

php-web-hosting
kaciranlar icin yazayim dün gece 8. RC ardindan Php 5.4 yayinlandi.
Degisiklikleri uzun uzun anlatmiyacagim, release ler ciktiginda birsürü blogda zaten yeniliklerden bahsedildi.
Önemli degisiklilere kisa bir göz gezdirelim.

1. Traits
Php gibi tek mirasli dillerde kodu tekrar kullanmak icin olan bir yöntemdir.

<?php
class Base {
    public function sayHello() {
        echo 'Hello ';
    }
}

trait SayWorld {
    public function sayHello() {
        parent::sayHello();
        echo 'World!';
    }
}

class MyHelloWorld extends Base {
    use SayWorld;
}

$o = new MyHelloWorld();
$o->sayHello();
?>

cikti
Hello World

2. shortened array syntax

<?php
function getArray() {
    return array(1, 2, 3);
}

// on PHP 5.4
$secondElement = getArray()[1];

// as of PHP 5.4
$array = [
    "foo" => "bar",
    "bar" => "foo"
];

3. Constructor ardindan direk Metod calistirila bilinir (Fluent Interface)

echo (new Foo)->bar()

< ?=
short_open_tag ‘e bakılmaksızın < ?= artık her zaman kullanılabilir. 4. Binär sayi bicimi kullanimi eklenmistir (0b)

$binary = 0b001001101;
echo $binary;

Class::{expr}()

class Test{
    public function method() {
        echo 'Hello';
    }

    public static function staticmethod() {
        echo 'Static';
    }
}

$method = 'staticmethod';
$test = new Test();

$test->method();        //Prints Hello
$test->$method();       //Prints Static
$test->{'method'}();    //Prints Hello

Test::method();         //Prints Hello
Test::$method();        //Prints Static
Test::{'method'}();     //Prints Hello

6. $GLOBALS lerde artik “lazy initialisation” kullaniliyor

Callable Type Hinting

<?php

// A function that uses type hinting
function typeHinting(callable $a) {
     echo $a() . PHP_EOL;
}

// A closure
$closure = function () {
     return __FUNCTION__;
};

// Call the type hinting function with the closure
typeHinting($closure); // {closure}

class testClass {
     public function testMethod() {
          return __METHOD__;
     }
}

// A mock object
$testObj = new testClass();

// The new way of calling object methods
$objCallable = array($testObj, 'testMethod');

// Call type hinting function with the new method calling way
typeHinting($objCallable); // testClass::testMethod

upload progress e direk erisim

session.upload_progress.enabled = 1 
session.upload_progress.prefix = upload_progress_
session.upload_progress.name = PHP_SESSION_UPLOAD_PROGRESS
<form action="upload.php" method="POST" enctype="multipart/form-data">
 <input type="hidden" name="<?php echo ini_get("session.upload_progress.name"); ?>" value="johannesupload" />
 <input type="file" name="file1" />
 <input type="file" name="file2" />
 <input type="submit" />
</form>

E_STRICT E_ALL un parcasi haline geldi
php.ini deki “default_charset” ISO-8859-1 den UTF-8 degistirildi
Php 5.4 kendi icinde kücük bir Webserver barindirmakta

Safe Mode, register_globals, register_long_arrays php.ini den kaldirildi
Magic Quotes (magic_quotes_gpc)

Simdlik bukadar unuttuklarim varsa asagiya ekleyiniz 😉

Linkler:
http://php.net/releases/5_4_0.php
http://docs.php.net/manual/en/migration54.new-features.php
http://blog.claudiupersoiu.ro/2012/02/11/php-5-4-closures-the-right-way/
http://schlueters.de/blog/archives/151-Upload-Progress-in-PHP-trunk.html
http://php.net/manual/en/features.commandline.webserver.php

Skorp
2012-03-02
Tags:
PHP
Share story:
← PreviousjQuery UI Dialog enterle tetiklemek
Next →Silverstripe: Sorgulari Cachleme

Written by Skorp

View all articles by Skorp

Website: https://www.skorp.eu

Related Articles

  • Silverstripe snippetler

  • Silverstripe login sorunu

  • Silverstripe: Sorgulari Cachleme

  • Silverstripe yeni sayfa tipleri

  • Silverstripe

Comments are closed.

Social networks

Etiket Bulutu

Android Bilgisayar & Internet C# Cms css diger Kodlar featured Genel Java Javascript Linux Mobile PHP Silverstripe typo3 Veritabani Windows Zend Framework

Links

  • H E R K O N U
  • Hüseyin Koyun
  • Urban23k

Son Yorumlar

  • Onur on Primary Key – Unique ve Index nedir?
  • sezer fidancı on Centos de apache, php ve mysql kurulumu
  • React Native | Kadir Özdemir on React Native – Kurulum
  • React Native – Kurulum | Kadir Özdemir on React Native
  • serkan on Ben Kimim

Twitter

Follow @skorp54
    There is an error in twitter widget, please make sure that you have set up the Twitter API settings
  • Ben Kimim
  • PHP
  • Sencha Touch

Arsivler

Kategoriler

Copyright © 2014 webberz.at