<?php
$str = '<link rel="shortcut icon" href="http://localhost/teste/icon1.png">
<link rel="shortcut icon" href="http://localhost/teste/icon2.png">
<link rel="shortcut icon" href="http://localhost/teste/icon3.png">
<link rel="shortcut icon" href="http://localhost/teste/icon4.png">';
function transpose( $array ) {
}
function( $current ) {
'/\s*(\w+)="(.*?)\s*"/',
$current, NULL, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
);
$transposed = transpose
( array_chunk( $attributes, 2 ) );
},
$matches[ 1 ]
);
PD9waHAKCiRzdHIgPSAnPGxpbmsgcmVsPSJzaG9ydGN1dCBpY29uIiBocmVmPSJodHRwOi8vbG9jYWxob3N0L3Rlc3RlL2ljb24xLnBuZyI+CjxsaW5rIHJlbD0ic2hvcnRjdXQgaWNvbiIgaHJlZj0iaHR0cDovL2xvY2FsaG9zdC90ZXN0ZS9pY29uMi5wbmciPgo8bGluayByZWw9InNob3J0Y3V0IGljb24iIGhyZWY9Imh0dHA6Ly9sb2NhbGhvc3QvdGVzdGUvaWNvbjMucG5nIj4KPGxpbmsgcmVsPSJzaG9ydGN1dCBpY29uIiBocmVmPSJodHRwOi8vbG9jYWxob3N0L3Rlc3RlL2ljb240LnBuZyI+JzsKCnByZWdfbWF0Y2hfYWxsKCAnLzxsaW5rXHMqKFx3Kz0iLio/Iik+LycsICRzdHIsICRtYXRjaGVzICk7CgpmdW5jdGlvbiB0cmFuc3Bvc2UoICRhcnJheSApIHsKCQogICAgYXJyYXlfdW5zaGlmdCggJGFycmF5LCBudWxsICk7CiAgICAKICAgIHJldHVybiBjYWxsX3VzZXJfZnVuY19hcnJheSggJ2FycmF5X21hcCcsICRhcnJheSApOwp9CgokbWF0Y2hlcyA9IGFycmF5X21hcCgKCiAgICBmdW5jdGlvbiggJGN1cnJlbnQgKSB7CgogICAgICAgICRhdHRyaWJ1dGVzID0gcHJlZ19zcGxpdCgKICAgICAgICAJCiAgICAgICAgCScvXHMqKFx3Kyk9IiguKj8pXHMqIi8nLAogICA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