<?php
$str = "aaaaaaaaaa";
$carater="-";
$apartir=3;
$ate=7;
$ambos="ambos";
$entre="entre";
if ($apartir==3){
$nome=substr($str, $compr-$apartir, $compr); $right = str_pad($nome, $compr, $carater, STR_PAD_RIGHT
); }
if ($ate==7){
$nome=substr($str, $compr-$apartir, $compr); $left = str_pad($nome, $compr, $carater, STR_PAD_LEFT
); }
if($ambos=="ambos"){
$nome=substr($str, $ate, $compr); $both = str_pad($nome, $compr, $carater, STR_PAD_BOTH
); }
echo $right;
echo "\n";
echo $left;
echo "\n";
echo $both;
echo "\n";
$quant=2;
$inicio = $fim = $parts[0];
$aux=substr($str,$quant*2,$compr);
$meio=$inicio.$compl.$fim;
echo $meio;
PD9waHAKCgkkc3RyID0gImFhYWFhYWFhYWEiOwoJJGNhcmF0ZXI9Ii0iOwoJJGFwYXJ0aXI9MzsKCSRhdGU9NzsKCSRhbWJvcz0iYW1ib3MiOwoJJGVudHJlPSJlbnRyZSI7CgkkY29tcHI9c3RybGVuKCRzdHIpOwoJCglpZiAoJGFwYXJ0aXI9PTMpewoJICRub21lPXN1YnN0cigkc3RyLCAkY29tcHItJGFwYXJ0aXIsICRjb21wcik7CgkgJHJpZ2h0ID0gc3RyX3BhZCgkbm9tZSwgJGNvbXByLCAkY2FyYXRlciwgU1RSX1BBRF9SSUdIVCk7Cgl9CgkKCWlmICgkYXRlPT03KXsKCSAgJG5vbWU9c3Vic3RyKCRzdHIsICRjb21wci0kYXBhcnRpciwgJGNvbXByKTsKCSAgJGxlZnQgPSBzdHJfcGFkKCRub21lLCAkY29tcHIsICRjYXJhdGVyLCBTVFJfUEFEX0xFRlQpOwoJfQoJCglpZigkYW1ib3M9PSJhbWJvcyIpewoJCSRub21lPXN1YnN0cigkc3RyLCAkYXRlLCAkY29tcHIpOwoJCSRib3RoID0gc3RyX3BhZCgkbm9tZSwgJGNvbXByLCAkY2FyYXRlciwgU1RSX1BBRF9CT1RIKTsKCX0KCQoJICAgIGVjaG8gJHJpZ2h0Owo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