| Instrucción | Qué hace |
|---|---|
| break | Sale del bucle por completo |
| continue | Salta la iteración actual |
| Uso típico | Buscar algo y detener |
| Uso típico | Filtrar o ignorar datos |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RewriteEngine On | |
| RewriteCond %{REQUEST_FILENAME} !-f | |
| RewriteCond %{REQUEST_FILENAME} !-d | |
| RewriteRule ^(.*)$ Index.php [QSA,L] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| declare(strict_types=1); | |
| class Customer | |
| { | |
| public function __construct( | |
| public string $name, | |
| public string $email | |
| ) {} | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| declare(strict_types=1); | |
| require_once __DIR__ . '/src/ProcessOrder.php'; | |
| $cart = [ | |
| ["name" => "Mouse", "price" => 100, "quantity" => 2], | |
| ["name" => "Teclado", "price" => 150, "quantity" => 1], | |
| ["name" => "Producto roto"], // sin price/quantity -> salta |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| declare(strict_types=1); | |
| $users = [ | |
| ["name" => "Teddy", "role" => "admin", "age" => 28], | |
| ["name" => "Edgar", "role" => "user", "age" => 16], | |
| ["name" => "Devi", "role" => "editor", "age" => 22], | |
| ["name" => "Maria", "role" => "user", "age" => 35], | |
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| declare(strict_types=1); | |
| function requireField(array $data, string $field): string | |
| { | |
| return "Implementar función"; | |
| } | |
| function calculateTotal(float $price, int $quantity): float | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $catalog = [ | |
| ["sku" => "LP-001", "name" => "Laptop", "price" => 1200, "stock" => 3], | |
| ["sku" => "MS-002", "name" => "Mouse", "price" => 25, "stock" => 0], | |
| ["sku" => "KB-003", "name" => "Teclado", "price" => 80, "stock" => 12], | |
| ]; | |
| $usersTask = [ | |
| ["id" => 1, "name" => "Ana", "email" => "ana@email.com", "role" => "user"], | |
| ["id" => 2, "name" => "Luis", "email" => "luis@email.com", "role" => "admin"], | |
| ["id" => 3, "name" => "María", "email" => "maria@email.com", "role" => "editor"], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $cart = [ | |
| ["product" => "Laptop", "price" => 1200], | |
| ["product" => "Mouse", "price" => 20], | |
| ["product" => "Teclado", "price" => 80] | |
| ]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $users = [ | |
| [ | |
| "id" => 1, | |
| "name" => "Ana García", | |
| "username" => "ana.garcia", | |
| "email" => "ana.garcia@example.com", | |
| "role" => "user", | |
| "status" => "active", | |
| "last_login" => "2026-01-20 09:15" |
NewerOlder