在PHP中获取数组索引[关闭]

在PHP中获取数组索引[关闭]

问题描述:

Following issue is facing, plz need solution. Please have a look of attach image Regards

enter image description here

以下问题正面临,PLZ需要解决方案。 请看一下附加图像 Regards p> \ n

p> div>

use following code

$file = fopen("test.txt","r");
$array=array();
while(! feof($file))
  {
    $line       =   fgets($file);
    $arrayChunk = explode("$", $line);
    $array[]    =   $arrayChunk;
  }
fclose($file);
print "<pre>";
print_r($array);

Try like this

$text = text from file;
$arr = explode("
",$text);
$final = array();
foreach($arr as $array){
    $final = explode('$SPL$',$array);
}
print_r($final);

$file = fopen("test.txt","r");
$array=array();
while(! feof($file))
  {
    $file_content = fgets($file);
    $explodedData = explode("$SPL$", $file_content);
    $requiredData[] = $explodedData;
  }
fclose($file);
print "<pre>";
print_r($requiredData);