'saved', 'answer' => '', ), ); $new = array( array( 'question' => 'new', 'answer' => '', ), ); return self::forWrite( $saved, $new, 'replace' ) === $new; } /** * @param mixed $pair A `{question, answer}` pair. * @return string The question's comparison key; '' when it has none. */ private static function questionKey( $pair ): string { $question = is_array( $pair ) && is_string( $pair['question'] ?? null ) ? $pair['question'] : ''; $question = html_entity_decode( wp_strip_all_tags( $question ), ENT_QUOTES | ENT_HTML5, 'UTF-8' ); $folded = (string) preg_replace( '/[^\p{L}\p{N}]+/u', ' ', $question ); $key = function_exists( 'mb_strtolower' ) ? mb_strtolower( $folded, 'UTF-8' ) : strtolower( $folded ); return trim( str_replace( array( 'ı', "\u{0307}" ), array( 'i', '' ), $key ) ); } }