Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $field = "R1-H1-B1-K1-Q1-B1-H1-R1/P1-P1- -P1-P1- -P1-P1/ - -P1- - - - - /- - - - -P1- - /- - - - - - - /-P2- - - - - -H2/P2- -P2-P2-P2-P2-P2-P2/R2-H2-B2-K2-Q2-B2- -R2";
- $rows = explode('/', $field);
- $rows = array_filter($rows, function($val) {
- $valid_figures = array('R1', 'B1', 'Q1', 'K1', 'P1', 'H1', '', ' ', 'R2', 'B2', 'Q2', 'K2', 'P2', 'H2');
- $figures_in_field = explode('-', $val);
- $diff = array_diff(array_diff($figures_in_field, $valid_figures), $valid_figures);
- if(count($figures_in_field) != 8 || !count($diff) == 0) { return false; } else { return true; }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement