0

Hi,

I have a problem to split and get the value in string. here example output

--_BeginData_
payeeId=xxxx
channelId=ECEP
billAccountNo=exb111109-315262
billReferenceNo=TOPUP20111109200257
amount=42
paymentRefNo=61417686
transactionDate=20111109
transactionTime=194843
userFullName=KHOR JO FENG
status=S
--_EndData_

In above example,

i need output for payeeId=xxxx, billAccountNo=exb111109-315262, billReferenceNo=TOPUP20111109200257 and etc.,

so i want value after the equal. It means i need xxxx and exb111109-315262 and etc.,

how can i get it and reply asap. Tq.

William.

3
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by diafol
0
<?php
$string="--_BeginData_
payeeId=xxxx
channelId=ECEP
billAccountNo=exb111109-315262
billReferenceNo=TOPUP20111109200257
amount=42
paymentRefNo=61417686
transactionDate=20111109
transactionTime=194843
userFullName=KHOR JO FENG
status=S
--_EndData_";


$data=split("\n", $string);
echo "<pre>";
print_r($data);
echo "</pre>";

for ($i=1;$i<=10;$i++)
{
	$rec=split("=", $data[$i]);	
	echo $rec[1]."<br>";
}


?>
0

WRT use of split(), from php.net:

This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.

maybe try:

echo str_replace("\n",", ",substr($string,15,-13));

You avoid using loops and arrays. Perhaps "\n" won't work, if not try "\n\r".

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.