This file contains hidden or 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 | |
$str = preg_replace('/\s\s+/u', ' ', $str); // no issue with cyrillic letters, because using "u" modifier for UTF-8 |
This file contains hidden or 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
<? | |
// clean $field value from non numeric characters | |
$field = "234.345g"; | |
echo $field . '<br>'; // 234.345g | |
$fieldFloat = floatval( preg_replace( '/[^-0-9\.]/', "", $field ) ); // 234.345 | |
$fieldInt = intval( preg_replace( '/[^-0-9]/', "", $field ) ); // 234 | |
echo $fieldFloat . '<br>'; | |
echo $fieldInt . '<br>'; | |
?> |
This file contains hidden or 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
<? | |
// Настройки продукта / Почтовые события / Типы почтовых событий | |
// создаем новый тип почтового события MY_NEW_MAIL_EVENT | |
$mailFields[ "EMAIL_FROM" ] = "[email protected]"; | |
$mailFields[ "EMAIL_TO" ] = "[email protected],[email protected]"; | |
$mailFields[ "PROP_SOME_VALUE" ] = 'some text is here'; | |
$mailFields[ "PROP_OTHER_VALUE" ] = 'some other text is here'; | |
// Создаем новый почтовый шаблон. |
This file contains hidden or 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
AddDefaultCharset utf-8 |
This file contains hidden or 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 | |
$arLines = preg_split( '/\r?\n/i', trim( $longText ) ); |
This file contains hidden or 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
body,html { | |
height: 100%; | |
} | |
div#mydiv { | |
height: 100% | |
} |
This file contains hidden or 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
<html> | |
<head> | |
<title>Test</title> | |
<style> | |
html,body{ | |
width: 100%; | |
height: 100%; | |
margin: 0; | |
padding: 0; |
This file contains hidden or 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 | |
// in functions.php | |
function my_theme_setup() | |
{ | |
add_image_size('my-thumbnail', 310, 160); | |
} | |
add_action( 'after_theme_setup', 'my_theme_setup' ); | |
?> | |
<?php |
This file contains hidden or 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 | |
echo "TimeZone: " . date_default_timezone_get(); | |
echo " Current date and time: " . date( 'Y-m-d H:i:s' ); | |
// We also can set timezone at runtime | |
// date_default_timezone_set('America/Los_Angeles'); | |
?> |