什么时候在php中是邪恶的?
在我用php开发的所有年份中,我一直都听说使用eval()邪恶。 考虑以下代码,使用第二个(更优雅的)选项是否有意义?如果没有,为什么? // $type is the result of an SQL statement // e.g. SHOW COLUMNS FROM a_table LIKE 'a_column'; // hence you can be pretty sure about the consistency // of your string $type = "enum('a','b','c')"; // possibility one $type_1 = preg_replace('#^enum\s*\(\s*\'|\'\s*\)\s*$#', '', $type); $result = preg_split('#\'\s*,\s*\'#', $type_1); // possibility …