note 110235 added to function.file-get-contents
| From: | rnd | Date: | Thu, 04 Oct 2012 03:45:02 +0000 |
| Subject: | note 110235 added to function.file-get-contents | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-191121@lists.php.net to get a copy of this message | ||
Function to get enum values for table field.
<?php
function enumValues($filename) {
$fGetContents = file_get_contents($filename);
$e = explode("\n", $fGetContents);
for ($i = 0; $i < count($e); $i++) {
$arr[] = $e[$i] ."','";
}
$str = implode('', $arr);
$var = "'" . $str;
$var = substr($var, 0, -2);
return $var;
}
?>
Insert into file like this
Value1
Value2
Value3
Thanks: http://www.php.net/manual/en/function.file-get-contents.php#102319
----
Server IP: 69.147.83.199
Probable Submitter: 82.147.184.179
----
Manual Page -- http://www.php.net/manual/en/function.file-get-contents.php
Edit -- https://master.php.net/note/edit/110235
Del: integrated -- https://master.php.net/note/delete/110235/integrated
Del: useless -- https://master.php.net/note/delete/110235/useless
Del: bad code -- https://master.php.net/note/delete/110235/bad+code
Del: spam -- https://master.php.net/note/delete/110235/spam
Del: non-english -- https://master.php.net/note/delete/110235/non-english
Del: in docs -- https://master.php.net/note/delete/110235/in+docs
Del: other reasons-- https://master.php.net/note/delete/110235
Reject -- https://master.php.net/note/reject/110235
Search -- https://master.php.net/manage/user-notes.php