Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
151 changes: 72 additions & 79 deletions releases/8.0/tr.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
include_once __DIR__ . '/common.php';

releases\php80\language_redirect('tr');

releases\php80\common_header(
'PHP 8.0, PHP dili için önemli bir güncellemedir. Optimizasyonlar ve yeni özellikler: Adlandırılmış ' .
'Değişkenler, Union Types, Attributes, Kurucularda Özellik Tanımı, Match İfadesi, Nullsafe Operatorü, ' .
'JIT(Anında Derleme) yanında tip sistemi, hata işleme ve tutarlılıkta iyileştirmeler içerir.');

?>

<section class="php8-section php8-section_dark php8-section_header center">
<div class="page-tools">
<div class="change-language">
Expand Down Expand Up @@ -77,13 +77,12 @@
<div class="php8-compare__label">PHP 7</div>
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
'class PostsController
{
/**
* @Route("/api/posts/{id}", methods={"GET"})
*/
public function get($id) { /* ... */ }
}'
'class PostsController {
/**
* @Route("/api/posts/{id}", methods={"GET"})
*/
public function get($id) { /* ... */ }
}'
);?>
</div>
</div>
Expand All @@ -92,11 +91,10 @@ public function get($id) { /* ... */ }
<div class="php8-compare__label php8-compare__label_new">PHP 8</div>
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
'class PostsController
{
#[Route("/api/posts/{id}", methods: ["GET"])]
public function get($id) { /* ... */ }
}'
'class PostsController {
#[Route("/api/posts/{id}", methods: ["GET"])]
public function get($id) { /* ... */ }
}'
);?>
</div>
</div>
Expand All @@ -117,20 +115,20 @@ public function get($id) { /* ... */ }
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
'class Point {
public float $x;
public float $y;
public float $z;
public float $x;
public float $y;
public float $z;

public function __construct(
float $x = 0.0,
float $y = 0.0,
float $z = 0.0,
) {
$this->x = $x;
$this->y = $y;
$this->z = $z;
}
}'
public function __construct(
float $x = 0.0,
float $y = 0.0,
float $z = 0.0,
) {
$this->x = $x;
$this->y = $y;
$this->z = $z;
}
}'
);?>
</div>
</div>
Expand All @@ -140,12 +138,12 @@ public function __construct(
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
'class Point {
public function __construct(
public float $x = 0.0,
public float $y = 0.0,
public float $z = 0.0,
) {}
}'
public function __construct(
public float $x = 0.0,
public float $y = 0.0,
public float $z = 0.0,
) {}
}'
);?>
</div>
</div>
Expand All @@ -166,18 +164,18 @@ public function __construct(
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
'class Number {
/** @var int|float */
private $number;
/** @var int|float */
private $number;

/**
* @param float|int $number
*/
public function __construct($number) {
$this->number = $number;
}
}
/**
* @param float|int $number
*/
public function __construct($number) {
$this->number = $number;
}
}

new Number(\'NaN\'); // Ok'
new Number(\'NaN\'); // Ok'
);?>
</div>
</div>
Expand All @@ -187,12 +185,12 @@ public function __construct($number) {
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
'class Number {
public function __construct(
private int|float $number
) {}
}
public function __construct(
private int|float $number
) {}
}

new Number(\'NaN\'); // TypeError'
new Number(\'NaN\'); // TypeError'
);?>
</div>
</div>
Expand All @@ -214,15 +212,15 @@ public function __construct(
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
'switch (8.0) {
case \'8.0\':
$result = "Oh no!";
break;
case 8.0:
$result = "This is what I expected";
break;
}
echo $result;
//> Oh no!'
case \'8.0\':
$result = "Oh no!";
break;
case 8.0:
$result = "This is what I expected";
break;
}
echo $result;
//> Oh no!'
);?>
</div>
</div>
Expand All @@ -232,10 +230,10 @@ public function __construct(
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
'echo match (8.0) {
\'8.0\' => "Oh no!",
8.0 => "This is what I expected",
};
//> This is what I expected'
\'8.0\' => "Oh no!",
8.0 => "This is what I expected",
};
//> This is what I expected'
);?>
</div>
</div>
Expand All @@ -262,17 +260,17 @@ public function __construct(
<?php highlight_php_trimmed(
'$country = null;

if ($session !== null) {
$user = $session->user;
if ($session !== null) {
$user = $session->user;

if ($user !== null) {
$address = $user->getAddress();

if ($address !== null) {
$country = $address->country;
}
}
}'
if ($user !== null) {
$address = $user->getAddress();
if ($address !== null) {
$country = $address->country;
}
}
}'
);?>
</div>
</div>
Expand Down Expand Up @@ -334,8 +332,7 @@ public function __construct(
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
'strlen([]); // Warning: strlen() expects parameter 1 to be string, array given

array_chunk([], -1); // Warning: array_chunk(): Size parameter expected to be greater than 0'
array_chunk([], -1); // Warning: array_chunk(): Size parameter expected to be greater than 0'
);?>
</div>
</div>
Expand All @@ -345,8 +342,7 @@ public function __construct(
<div class="php8-code phpcode">
<?php highlight_php_trimmed(
'strlen([]); // TypeError: strlen(): Argument #1 ($str) must be of type string, array given

array_chunk([], -1); // ValueError: array_chunk(): Argument #2 ($length) must be greater than 0'
array_chunk([], -1); // ValueError: array_chunk(): Argument #2 ($length) must be greater than 0'
);?>
</div>
</div>
Expand Down Expand Up @@ -422,7 +418,7 @@ public function __construct(
<h2 class="php8-h2 php8-h2_margin-top">Diğer PHP sözdizimi düzenlemeleri ve iyileştirmeleri</h2>
<ul>
<li>
Parametre ve closure listelerinin sonunda virgül kullanılabilmesi <a href="https://wiki.php.net/rfc/trailing_comma_in_parameter_list">RFC</a>
Parametre ve kapatma(closure) listelerinin sonunda virgül kullanılabilmesi <a href="https://wiki.php.net/rfc/trailing_comma_in_parameter_list">RFC</a>
<a href="https://wiki.php.net/rfc/trailing_comma_in_closure_use_list">RFC</a>
</li>
<li>
Expand Down Expand Up @@ -494,7 +490,4 @@ public function __construct(
</div>
</section>




<?php site_footer();
<?php site_footer();