I moved both $ar's outside of the memory testing range and changed the second one to $ar2 (so that it wouldn't cause a drop in memory from that being overwritten), and this is what I got as output:
10000 iterations, 545608 bytes in array
10000 iterations, 545608 bytes in array (100.00%)
This makes sense, since in both cases it's just storing it as a simple reference until it gets modified. But, this gave me the idea of taking the loop out and just trying $ar and $ar2, and I finally got it, I think.
<?php
$start = memory_get_usage();
$ar = array_pad(array(), 4, "A");
$end = memory_get_usage();
printf("%d bytes in array\n", $end-$start);
$start2 = memory_get_usage();
$ar2 = array("A");
$ar2[] = $ar2[0];
$ar2[] = $ar2[0];
$ar2[] = $ar2[0];
$end2 = memory_get_usage();
printf("%d bytes in array (%.2f%%)\n", $end2-$start2, ($end2-$start2)/($end-$start)*100);
?>
Output:
496 bytes in array
496 bytes in array (100.00%)
I tried re-implementing this into the loop, and it came out to within 40 bytes of each other, which I will accept as close enough. So, what this means is, when you call array_pad(), it makes the first element unique, and then all the other elements in the padding are just references to that first unique element.