Definition:
function extract_from_markers( $filename, $marker ) {}
Parameters
- unknown_type $filename
- unknown_type $marker
Return values
returns:An array of strings from a file (.htaccess ) from between BEGIN and END markers.
Source code
function extract_from_markers( $filename, $marker ) { $result = array (); if (!file_exists( $filename ) ) { return $result; } if ( $markerdata = explode( "\n", implode( '', file( $filename ) ) )); { $state = false; foreach ( $markerdata as $markerline ) { if (strpos($markerline, '# END ' . $marker) !== false) $state = false; if ( $state ) $result[] = $markerline; if (strpos($markerline, '# BEGIN ' . $marker) !== false) $state = true; } } return $result; }
1046
No comments yet... Be the first to leave a reply!