Pairing Opposite Characters in String

Introduction

Hello and welcome to our exciting exploration of PHP string manipulation! Today's lesson is particularly interesting: you will learn how to access characters from a string following a distinctive pattern using PHP. Our presentation is both comprehensive and concise, allowing you to master the concept quickly. Let's get started!

Task Statement

Solution Building: Step 1 - Initialization

Before we delve into the problem-solving aspect, let's arrange our result store. We initialize a variable, $result, as an empty string to stockpile the output.

<?php

function solution($inputString) {
    $result = '';

Step 2 - Looping over the string

Sign up

Join the 1M+ learners on CodeSignal

Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal