Let’s create a variable or two and manipulate the strings with Pythons built in functions. #Importing the string module import string tutorial = ‘a crash course in python’ #capitalize the string tutorial.capitalize() #UPPERCASE the entire string import string string.upper(tutorial) #Concatenate…
When you need to access a specific module within the library you need to perform the following command; import libraryName
Matching a string between 4 and 128 characters with PHP and Regex. Works with preg_match and preg_match_all which use the PCRE Library. $string = “tutorial”; if (!preg_match(‘#^(.){4,128}$#’, $string)) { echo ‘The string you entered is invalid.’; }
A list of PHP return types which can be used in function arguments, return values and class properties. Table courtesy of php.net under license. Type Description Version Class/interface name The value must be an instanceof the given class or interface….
Creating a PHP Class with Type Hinting and Return Types How to create a PHP class with strict type, getters and setters and method return types. class automobile { public int $speed; function __construct() { $this->speed = 10; } function…
Creating a PHP function in PHP 8 How to create a function / method in PHP with type hinting and return types. function is_greater_than(int $x, int $y) : bool { return ($x > $y) ? true : false; } is_greater_than(1,2);
Validate an email with PHP and Regex Works with preg_match and preg_match_all which use the PCRE Library. $email = ‘editor@devtutorials4u.co.uk’ if (!preg_match(‘^[_A-Za-z0-9-]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$^’, $email)) { echo ‘The email address you entered was invalid.’; }
Shorthand (ternary expression) If Statement in PHP function greater_than() { return ($x > $y) ? true : false; }
PHP 4, PHP 5, PHP 7, PHP 8 If Statement with greater than condition. if ($x > $y) echo “x gtr than $y”; if ($x > $y) { echo “x gtr than $y”; $x = $y; }
Tauri is a framework for building binaries for all major desktop platforms. the Tauri team is pleased to announce the 1.1.0 release. New features include cargo-binstall Support for Tauri CLI, Security patch, Icon Generation, System Trays at Runtime. Full Release.