PHP

- Files
.php.phtml- Formats as
- Ur
- Lints
- Every rule that reads its code
- In
ur.toml [format.php]
Formatted
cart.php, as written<?php
// What a cart costs.
function subtotal(array $items):int{$sum=0;foreach($items as $item){$sum+=$item['price']*$item['quantity'];}return $sum;}
function label(array $item):string{return $item['name'].' x'.$item['quantity'];}
ur format --style ur cart.php<?php
// What a cart costs.
function subtotal(array $items):int{$sum=0; foreach($items as $item){$sum+=$item['price']*$item['quantity']; }return $sum; }
function label(array $item):string{return $item['name'].' x'.$item['quantity']; }
Versions
Ur reads PHP as the profiles below name it. Name the versions a project targets in target; without it, Ur reads php-8.5.
| Profile | Dialect |
|---|---|
php-7.4 | Zend |
php-8.0 | Zend |
php-8.1 | Zend |
php-8.2 | Zend |
php-8.3 | Zend |
php-8.4 | Zend |
php-8.5 | Zend |