<?php
$v = [];
$tamanho = 0;

while (true) {
    $linha = trim(fgets(STDIN));
    $partes = explode(" ", $linha);
    $op = $partes[0];

    if ($op == "0") break;

    if ($op == "1") {
        $v[$tamanho] = $partes[1];
        $tamanho++;
    } elseif ($op == "2") {
        $indice_real = $partes[1] - 1;

        if ($indice_real >= 0 && $indice_real < $tamanho) {
            for ($i = $indice_real; $i < $tamanho - 1; $i++) {
                $v[$i] = $v[$i + 1];
            }
            unset($v[$tamanho - 1]);
            $tamanho--;
        }
    } elseif ($op == "3") {
        for ($i = 0; $i < $tamanho; $i++) {
            echo $v[$i];
            if ($i < $tamanho - 1) echo " ";
        }
        echo "\n";
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: