How To Split A Line From An Array Into Two Variables Using PHP
<p>Here is the script as I am using it now:</p>

<pre><code>&lt;?php 
echo '&lt;html&gt;&lt;body&gt;';

// Data from a flat file  
$dataArray = file('text.dat');

// Get the current page  
if (isset($_REQUEST['page'])) {
    $currentPage = $_REQUEST['page'];
} else {
    $currentPage = 'some default value';
}

// Pagination settings  
$perPage = 3;  
$numPages = ceil(count($dataArray) / $perPage);  
if(!$currentPage || $currentPage &gt; $numPages)  
    $currentPage = 0;  
$start = $currentPage * $perPage;  
$end = ($currentPage * $perPage) + $perPage;

// Extract ones we need  
foreach($dataArray AS $key =&gt; $val)  
{  
    if($key &gt;= $start &amp;&amp; $key &lt; $end)  
        $pagedData[] = $dataArray[$key];  
}

foreach($pagedData AS $item)  
    echo '&lt;a href="/'. $item .'/index.php"&gt;'. $item .'&lt;/a&gt;&lt;br&gt;';

if($currentPage &gt; 0 &amp;&amp; $currentPage &lt; $numPages)  
    echo '&lt;a href="?page=' . ($currentPage - 1) . '"&gt;« Previous page&lt;/a&gt;&lt;br&gt;';  
if($numPages &gt; $currentPage &amp;&amp; ($currentPage + 1) &lt; $numPages)  
    echo '&lt;a href="?page=' . ($currentPage + 1) . '" class="right"&gt;Next page »&lt;/a&gt;&lt;br&gt;';

echo '&lt;/body&gt;&lt;/html&gt;';
?&gt;
</code></pre>

<p>And here is the contents of text.dat</p>

<pre><code>Fun
Games
Toys
Sports
Fishing
Pools
Boats
</code></pre>

<p>Now, my question is, What if text.dat looked like this?:</p>

<pre><code>Fun||http://site.com/page11.html
Games||http://site.com/page12.html
Toys||http://site.com/page13.html
Sports||http://site.com/page16.html
Fishing||http://site.com/page18.html
Pools||http://site.com/page41.html
Boats||http://site.com/page91.html
</code></pre>

<p>I would like to know what to change in the script so I can basically do this instead:</p>

<pre><code>foreach($pagedData AS $item1 and $item2)  
    echo '&lt;a href="'. $item2 .'"&gt;'. $item1 .'&lt;/a&gt;&lt;br&gt;';
</code></pre>
