ma non ti serve la regex.
fai cosi':
Codice PHP:<?php
class Car {
public $args = array();
function __construct(){
$this->args = func_get_args();
}
};
$cars = array();
$c = preg_replace(array('/cars\\[/','/,\\)/'), array('$cars[',')'), file_get_contents('db.txt'));
eval($c);
foreach($cars as $car){
list($marca,$colore,$prezzo) = $car->args;
echo "marca: $marca colore: $colore prezzo: $prezzo
\n";
}

Rispondi quotando