I realize you are looking for a universal equivalent drop-in replacement for those 2 examples that will be PHP 7.2 compatible and I hope someone here will answer this (as this may help many people moving to php 7.2 and higher), but I do have the answer specific to your script example, which will at least help you in this specific case if not universally.
Full disclosure: I know and work with that specific script (on a PHP 7.2 server).
while (($ut = each($user_tracking)) && ($listed++ < CONFIG_USER_TRACKING_SESSION_LIMIT)) {
Should be changed to:
foreach ($user_tracking as $ut['value']) {
if ($listed++ >= CONFIG_USER_TRACKING_SESSION_LIMIT) {
break;
}
Find:
while (($pu = each($ut['value']['last_page_url']))&&($du = each($ut['value']['page_desc']))) {
And change to:
foreach ($ut['last_page_url'] as $key => $pu) {
$du = $ut['page_desc'][$key];
This does require a small code rewrite below, as we have changed the arrays to strings, but still get the data we need.
Find:
<tr bgcolor=ffffff>
<td class="dataTableContent" valign=top align="right"><?php echo date('H:i:s', $pu['key']); ?></td>
<td class="dataTableContent" nowrap valign=top align="left"> <a href="<?php echo $pu['value']; ?>" target="_new"><?php if ($du['value']!=''){ echo $du['value'];} ?></a> </td>
<td class="dataTableContent" width=100% align="left"><a href="<?php echo $pu['value']; ?>" target="_new"><?php echo chunk_split($pu['value'],40,"<br>"); ?></a></td>
</tr>
And change to:
<tr bgcolor=ffffff>
<td class="dataTableContent" valign=top align="right"><?php echo date('H:i:s', $key); ?></td>
<td class="dataTableContent" nowrap valign=top align="left"> <a href="<?php echo $pu; ?>" target="_new"><?php if ($du!=''){ echo $du;} ?></a> </td>
<td class="dataTableContent" width=100% align="left"><a href="<?php echo $pu; ?>" target="_new"><?php echo chunk_split($pu,40,"<br>"); ?></a></td>
</tr>
Hope this helps.