<?php

$null = chr(0);
$data = file_get_contents('o');

// Separate the dictionary from data (two nulls delimiter)
list($words, $data) = explode($null . $null, $data);    

// Separate the dictionary words from each other (one null delimiter)
$words = explode($null, $words);


// Our first substitution is the sting "0", so start from there.
$num = 0;

// For each of the words...
foreach ($words as $w) {
    // Replace its number form with itself
    $data = preg_replace('|\b'. $num .'\b|', $w, $data);
    
    // Next number for substitution
    $num++;
}

file_put_contents('d', $data);

?>