Forum Moderators: coopster
Currently with this code of mine,
$start_indicate = 'Capital';
$stock_contents = substr($file_contents, strpos($file_contents, $start_indicate) + strlen($start_indicate));
$end_indicate = "</body>";
$stock_contents = substr($stock_contents, 0, strpos($stock_contents, $end_indicate));
$stock_contents = str_replace("</tr>", "*", $stock_contents);
$stock_contents = strip_tags($stock_contents);
$stock_contents = preg_replace("/\n\s*/i", "", $stock_contents);
$stock_contents = explode("*", $stock_contents);
echo "<pre>";
print_r($stock_contents);
echo "</pre>";
I get the following output :
Array(
[0] =>
Structure
[1] =>
Authorised Capital
500.00
500.00
500.00
500.00
[2] =>
Issued Capital
491.65
491.65
491.65
491.65
)
But I want it this way :
Array (
[0] => Structure
)
Array
(
[0] => Authorised Capital
[1] => 500
[2] => 500
[3] => 500
)Array
(
[0] => Issued Capital
[1] => 491.65
[2] => 491.65
[3] => 491.65
[4] => 491.65
)
$stock_contents = str_replace("</tr>", "*", $stock_contents);
$stock_contents = preg_replace("/\n\s*/i", "\n", $stock_contents);
$stock_contents = preg_replace('/\s\s+/', "$", $stock_contents);
$stock_contents = strip_tags($stock_contents);
$stock_contents = preg_replace('/\s\n+/', "*", $stock_contents);
$stock_contents = explode("*", $stock_contents);
echo "<pre>";
for($i=0;$i<count($stock_contents);$i++)
{
$stock_details = explode( "$", $stock_contents[$i]);
print_r($stock_details);
}
echo "</pre>";
The output is like this :
Array
(
[0] =>
[1] => Structure
[2] =>
[3] =>
)
Array
(
[0] =>
[1] =>
[2] =>
[3] => Authorised Capital
[4] => 500.00
[5] => 500.00
[6] => 500.00
[7] => 500.00
[8] =>
)