好的,所以我有这个字符串:
"MICROSOFT CORP CIK#: 0000789019 (see all company filings)"
我想在“CORP”位之后切断一切.我将如何在PHP中执行此操作?我习惯了Python,所以我不确定这是怎么做的.
要清楚,这是我想要的输出:
"MICROSOFT CORP"
我在尝试:
$companyname = substr($companyname, 0, strpos($companyname, " CIK"));
而我什么也没有显示出来.
这是我的完整代码:
include 'simple_html_dom.php';
$html = file_get_html('http://www.sec.gov/cgi-bin/browse-edgar?company=&match=&CIK=MSFT&filenum=&State=&Country=&SIC=&owner=exclude&Find=Find+Companies&action=getcompany');
$companyname = $html->find('span[class=companyName]', 0);
$companyname = substr($companyname, 0, strpos($companyname, " CIK#")+5);
$bizadd = $html->find('div[class="mailer"]');
echo $companyname;
echo "
";
foreach ($bizadd as $value) {
$addvals = $value->find('span[class="mailerAddress"]');
echo "
";
foreach ($addvals as $value) {
echo $value;
echo "
";
}
}
?>