here is the html string i have:
$a_stack_of_codes = addslashes("<td nowrap align="right" valign="top" rowspan="1" width="8%" class=""><b>102.50</b><br><td nowrap align="right" valign="top" rowspan="1" width="8%" class="">150.00<br>");
i'm trying to get the bid price and buy price from the above string using the code:
$sbid = addslashes("<td nowrap align="right" valign="top" rowspan="1" width="8%" class=""><b>");
$ebid = "</b><br>";
$sbuy = addslashes("<td nowrap align="right" valign="top" rowspan="1" width="8%" class="">");
$ebuy = "<br>";
if(strstr($a_stack_of_codes, $sbid) && strstr($a_stack_of_codes, $ebid)){
$start = strpos($a_stack_of_codes, $sbid) + strlen($sbid);
$end = strpos($a_stack_of_codes, $ebid, $start);
$str = substr($a_stack_of_codes, $start, $end - $start);
$bid_price = trim($str);
}
if(strstr($a_stack_of_codes, $sbuy) && strstr($a_stack_of_codes, $ebuy)){
$start = strpos($a_stack_of_codes, $sbuy) + strlen($sbuy);
$end = strpos($a_stack_of_codes, $ebuy, $start);
$str = substr($a_stack_of_codes, $start, $end - $start);
$buy_price = trim($str);
}
----------------------------------------------------------------------
i get
$bid_price = 102.50;
$buy_price = <b>102.50</b>;
suppose to be
$bid_price = 102.50;
$buy_price = 150.00;
the beginning tags of bid price and buy price are the same, only diffrence is <b> is the bid price
is there a way to check if the $buy_price contains <b> then INCREMENT (some how) to the next $sbuy occurance? if so, how would the code look like?
thanks in advance!!!