Potential Coder
Potential Coder

Reputation: 91

php 5.3 ereg_replace to preg_replace

$this->Settings = array( "host" => $host , "user" => $user , "pass" => $pass );
    $this->db = $db;
    $this->Settings["name"] = ereg_replace  ("_", "", $this->db);
    $this->init();

I have an application that can't work after migrating to php 5.3 from php 5.2.

Even after i changed the ereg_replace line above to

$this->aSettings["name"] = preg_replace("/_/", "", $this->db);

It still doesn't get the settings from the db.

Upvotes: 1

Views: 337

Answers (1)

Ja͢ck
Ja͢ck

Reputation: 173562

There's no particular reason why your preg_replace() wouldn't work, but you could simply use str_replace() instead.

$this->Settings['Name'] = str_replace('_', '', $this->db);

This statement interests me though:

$this->db = $db;

Where is $db set? Follow that trail until you find where the real issue is,

Upvotes: 3

Related Questions