??? PHP? ??? ??? PSR-12?? ??? ??? ????. ?? PHP ?????? ?? ?? ?????? ?? ?? ? ???? ??? ?????? PHP ?????? ???? ???? ?? ??? ???. ???? ???? ?? ???? ???? PSR-12? ??? ??? ? ????, ?? ??, ?? ???? ?????. ? ?????? PSR-12? ????, ? ????, ????? PSR-12? ???? ??? ?? ??? ???????.
??
- PSR-12? ??????
- PSR-12? ? ??????
-
PSR-12? ?? ??
- ?? ??
- ?????? ? ?? ??
- ??? ? ???
- ?? ??
- ?? ? ??
- PSR-12? PHP ????? ???? ??
- PSR-12? ??? ? ??? ?? ??
- ?? ??
PSR-12? ??????
PSR-12? PHP-FIG(Framework Interoperability Group)?? ??? PHP? ?? ??? ??????. ?? PSR-2 ??? ???? ???? ?? PHP ??? ???? ????? ??? ???? ????? ????? ?? ??? ?????.
PSR-12? ???? ?? ?? ?? ?? ??? PHP ?? ??? ?? ????? ??? ???. PSR-12? ??? ???? ??? ??? ???? ??? ????? ??? ? ???? ?? ??? ? ?? ???? ?? ?? ????? ??? ? ????.
PSR-12? ? ??????
PSR-12? ?? ?? ??? ?? ??? ?? ?? ??? ???? ?? ????. ??? ??? ??? ????.
- ???: ?? ???? ??? ??? ?? ????? ?? ??? ???? ?? ??? ? ????.
- ??: ??? ??? ??? ??? ?? ????? ?? ? ???? ???? ???.
- ?????: ???? ??? ??? ??? ??? ?? ???, ??? ? ??? ? ????.
- ?? ???: ?? ?? ?????? ?? ?? ?????? ??? ? ?? ??? ??? ??? ????? ?? ???? ?????.
PSR-12? ?? ??
PSR-12? ???? ? ?? ?? ??? ???????. ?? ??? ??? ?? ?? ?? ??? ??? ????.
1. ?? ??
- ?? ??: PHP ???
- ???: ??? BOM(??? ?? ??) ?? UTF-8? ?????? ???.
- ? ??: ?? 120?? ??? ? ??? ?? 80?? ?????.
- ? ?: ?? PHP ?? ?? ?? ?? ??? ? ?? ??? ???. ?? return ? ?? ??? ?? ???? ? ?? ?? ??? ???.
2. ?????? ? ?? ??
PSR-12??? ???? ??? ?? ??????? ?? ??? ?? ??? ??? ???.
- ?????? ??: ?????? ??? ?? PHP ?? ??? ? ?? ???? ???. ?????? ??? ? ?? ?? ??? ???.
- ?? ??: ?? ?? ??? ?????? ?? ??? ?? ????? ? ?? ????? ???. ?? ??? ??? ??? ? ?? ?? ??? ???.
?:
<?php namespace App\Controllers; use App\Models\User; use App\Repositories\UserRepository; class UserController { // Class implementation }
3. ???? ???
PSR-12? ???, ?? ? ??? ?? ??? ?? ? ?? ??? ??? ?????.
- ??? ??: ??? ??? ??? ??? ??? ??? ?? ???. ?? ??? {? ??? ??? ?? ?? ????? ??, ?? ??? }? ? ?? ??? ???.
- ??: ?? ??? ?? ???(??, ??, ???)? ???? ???.
- ???: ??? ??? ???? ?? ??? ??? ??? ?? ? ???? ??? ??? ?? ???. ?? ???? ?? ???? ???? ???.
class UserController { private $userRepository; public function __construct(UserRepository $userRepository) { $this->userRepository = $userRepository; } } <h4> 4. ?? ?? </h4> <p>if, for, switch? ?? ?? ??? ?? ??? ??? ???.</p> <ul> <li> <strong>??</strong>: ?? ???? ?? ?? ??? ??? ?? ??? ???. ? ? ??? ??? {}? ?? ???? ???.</li> <li> <strong>????</strong>: ?? ?? ??? ?? ??? ? ??(????? ?? 4?)?? ??????? ???. </li> </ul> <pre class="brush:php;toolbar:false">if ($user->isAdmin()) { echo "User is an admin"; } else { echo "User is not an admin"; }
5. ?? ? ??
???? ??? ?? ??? ???? ??? ???? ? ?? ?????. PSR-12? ???? ??? ??? ???? ?????.
- ?? ??: ?? ?? ???? /* */? ???? ?? ?? ? ?? ????.
- ? ? ??: ??? ???? //? ???? ??? ??? ??? ?????.
<?php namespace App\Controllers; use App\Models\User; use App\Repositories\UserRepository; class UserController { // Class implementation }
PHP ????? PSR-12? ???? ??
?????? PSR-12? ???? ??? ??? ? ??? ???? ??? ? ??? ?? ??? ???? ?? ?? ??? ???? ??? ???? ????.
?? ??? ?? ???? ??? ?????.
- ???? ???? ??: ?????? ?? 4?? ?????.
- ? ?? ??: ?? 120? ???? ?????. ?, ???? ???? 80?? ?????.
- ?? ?? ??: ??? ??, ??? ? ?? ??? ?? ??? ????.
PSR-12? ??? ? ??? ?? ??
??? PSR-12? ???? ???? ???? ?? ??? ?? ?? ? ??? ? ????? ????? ? ??? ?? ??? ????.
1. PHP_?????
PHP ??? PSR-12? ???? ?? ?? ?? ?? ?? ? ??? PHP_CodeSniffer???. ??? ???? ???? ???? ??? ?????.
?? ? ?? ??:
class UserController { private $userRepository; public function __construct(UserRepository $userRepository) { $this->userRepository = $userRepository; } }
?? ?? ??? ?? ?????.
if ($user->isAdmin()) { echo "User is an admin"; } else { echo "User is not an admin"; }
2. PHP CS ??
? ?? ??? ??? PHP CS Fixer???. ??? ??? ?? ??? ???? PSR-12? ????? ??? ??? ?? ????.
// Fetch user from the repository $user = $userRepository->find($id); /* * If user is not found, throw an exception. * This helps in handling invalid user IDs. */ if (!$user) { throw new NotFoundException(); }
??? ???? Fixer? ?????.
composer require "squizlabs/php_codesniffer=*"
3. PHPStorm
PHPStorm? ???? ?? PSR-12? ???? ??? ? ????. ???? ?? -> ??? -> ?? ??? -> PHP ??? PSR-12? ?????.
?? ??
PHP ?????? PSR-12? ??? ?? ??? ??? ??? ???? ? ?????. ?? ???? ?? ?? ???? ???? ??? ? ????, ?? ??, ?? ???? ?? ??? ????. PSR-12? ??? ???? ??? ?? PHP ????? ?? ??? ???? ???.
? ??? ???? ?? ????? ???? ?? ??? ??? PHP ??? ???? ?? ?????. ??? ??? ???? ????? ? ?? ??? ????? ??? ???? ????? ??? ???!
??? ?????!
? ??? PSR ?? - PHP ?? ??? ???? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

PHP ?? ??? ?? ???? ?? ? ????? ??? ?????. 1. ?? ??? ??? ??? ??? ? ? ??? ??? ??? ?? ?? ??? ???? ???????. 2. ?? ??? ???? ???? ? ?? ????? ?? ?? ?? ??? ?????. 3. $ _get ? $ _post? ?? Hyperglobal ??? ?? ???? ?? ??? ? ??? ??? ??????? ???????. 4. ?? ?? ?? ???? ?? ?? ?? ??? ?????? ?? ??? ??? ?? ??? ???????. ??? ??? ????? ??? ??? ?? ???? ????? ? ??? ? ? ????.

PHP ?? ???? ???? ????? ?? ? ??? ???? ?? ?? ? ??? ???? ?? ??? ?????? ??? ??? ? ? ???????. 1. ??? ?? CSRF? ???? ?? ??? ??? ???? ?????? ??? ???? FINFO_FILE? ?? ?? MIME ??? ?????. 2. ??? ??? ??? ???? ??? ?? ??? ?? ? WEB ????? ??? ???? ??????. 3. PHP ?? ??? ?? ? ?? ???? NGINX/APACHE? ??? ????? ?? ???? ?????. 4. GD ?????? ??? ? ?? ???? ??? ?? ??? ?? ????.

PHP ?? ???? ? ?? ???? ??? ????. 1. // ?? #? ???? ? ?? ??? ???? // ???? ?? ????. 2. ?? /.../ ?? ?? ?? ??? ????? ?? ? ?? ??? ?? ? ? ????. 3. ?? ?? ?? / if () {} /? ?? ?? ??? ????? ??? ?? ?? ?? ??? ???? ????? ???? ??? ?? ???? ???? ??? ? ??? ??????.

Ageneratorinphpisamemory- ???? Way-Erate-Overgedatasetsetsbaluesoneatimeatimeatimeatimallatonce.1.generatorsuseTheyieldKeywordTocroadtOpvaluesondemand, RetingMemoryUsage.2

PHP ??? ???? ??? ??? ??? ????? ????. ??? ????? ?? ???? ??? "?? ? ?"??? "?"? ???????. 1. ??? ? ??? ??? DocBlock (/*/)? ?? ?? ??? ???? ??? ? ?? ???? ??????. 2. JS ??? ???? ?? ???? ??? ?? ??? ??? ?????. 3. ??? ?? ?? ?? ??? ???? ????? ????? ???? ?? ????? ???? ? ??????. 4. Todo ? Fixme? ????? ???? ? ? ??? ??? ???? ?? ?? ? ??? ???????. ??? ???? ?? ??? ??? ?? ?? ?? ???? ???? ? ????.

toinstallphpquickly, usexampponwindowsorhomebrewonmacos.1. ??, downloadandinstallxAmpp, selectComponents, startApache ? placefilesinhtdocs.2

tolearnpheffectical, startBysetTupaloCalserErverEnmentUsingToolslikexamppandacodeeditor -likevscode.1) installxamppforapache, mysql, andphp.2) useacodeeditorforsyntaxsupport.3)) 3) testimplephpfile.next, withpluclucincludechlucincluclucludechluclucled

PHP??? ???? ??? ?? ?? ????? ???? ??? ?? ??? ??? ?? ? ??? ??? ???? ?????. ???? 0?? ???? ?? ??? ???? ? ?? ???? ?? ?? ? ? ????. MB_SUBSTR? ?? ??? ??? ???????. ? : $ str = "hello"; echo $ str [0]; ?? H; ??? MB_SUBSTR ($ str, 1,1)? ?? ??? ??? ??? ??????. ?? ???????? ???? ??? ???? ?? ???? ?? ?? ???? ?????? ??? ????? ?? ??? ?? ??? ???? ???? ?? ????.
