<?php
$str = <<< EOB
/** preloader colors **/
@preloader_bg: #0081ff;
@preloader_color: #fff;
/** layout **/
@body_bg_image_position: ~'left top';
@body_bg_image_repeat: ~'no-repeat';
@body_bg_image_cover: ~'auto';
@body_bg_image: ~'';
EOB;
preg_match_all("~^@([^:]+):\s*([^;]+;?)$\K~m", $str, $matches, PREG_SET_ORDER);
var_dump($matches);
- Output for 5.6.0 - 5.6.25, 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- array(6) {
[0]=>
array(3) {
[0]=>
string(0) ""
[1]=>
string(12) "preloader_bg"
[2]=>
string(8) "#0081ff;"
}
[1]=>
array(3) {
[0]=>
string(0) ""
[1]=>
string(15) "preloader_color"
[2]=>
string(5) "#fff;"
}
[2]=>
array(3) {
[0]=>
string(0) ""
[1]=>
string(22) "body_bg_image_position"
[2]=>
string(12) "~'left top';"
}
[3]=>
array(3) {
[0]=>
string(0) ""
[1]=>
string(20) "body_bg_image_repeat"
[2]=>
string(13) "~'no-repeat';"
}
[4]=>
array(3) {
[0]=>
string(0) ""
[1]=>
string(19) "body_bg_image_cover"
[2]=>
string(8) "~'auto';"
}
[5]=>
array(3) {
[0]=>
string(0) ""
[1]=>
string(13) "body_bg_image"
[2]=>
string(4) "~'';"
}
}
preferences:
187.66 ms | 405 KiB | 226 Q