Last active
September 8, 2020 13:37
-
-
Save amorkovin/dbf0936ebf49bdd1b9b8b226402b892f to your computer and use it in GitHub Desktop.
Разное интересное в PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Разбирает URL и возвращает его компоненты (в данном случае вернется доменное имя) | |
parse_url($comment->comment_author_url, PHP_URL_HOST) | |
// Удаляет теги (может вторым параметром получить тег, который не надо удалять). В примере разрешено оставить тег br. | |
strip_tags($input, '<br>'); | |
// Редирект на php в любой момент ;) | |
echo "<script>window.location = '$next_iteration_url'</script>"; | |
// Просто пример swith - case инструкции. Иногда очень удобно | |
switch ( $args_filter_posts['post_type'] ) { | |
case 'brokers-post': | |
get_template_part( 'components/offer-item/brokers/broker-offer-item' ); | |
break; | |
default: | |
get_template_part( 'components/offer-item/credit-card/credit-card-offer-item' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment