I love math and programming. I worked with Bitrix for a long time. Recently, I realized that many things, due to long uselessness, began to be forgotten. I want to update my knowledge, improve my level and do those things that I could not have done before.
Exercise: Complete the solution so that it splits the string into pairs of two characters. If the string contains an odd number of characters then it should replace the missing second character of the final pair with an underscore (‘_’).
Solution:
function solution($str) {
if((strlen($str) % 2) !== 0)
$str .= "_";
return empty($str) ? [] : str_split($str, 2);
}
I worked as a backend PHP-programmer for Bitrix and Bitrix24.
Higher education of the Immanuel Kant Baltic Federal University, majoring in Business Informatics. In 2020, she took courses from the W3C on edX, called “Front-End Web Developer (FEWD) Professional Certificate”