The testing process: Implementing code or fixing bugs in PHP.
Motivation: Basic familiarity with the programming language used on the job is a prerequisite for quickly getting up to speed.
The testing process: Using data structures to optimize code performance.
Motivation: Choosing the right data structure to solve the problem at hand is a very important skill for a good programmer.
The testing process: Processing or building strings.
Motivation: String is one of the most commonly used data structures, so every programmer should be skilled at string manipulation.
Write a function that provides change directory (cd) function for an abstract file system.
- Root path is '/'.
- Path separator is '/'.
- Parent directory is addressable as '..'.
- Directory names consist only of English alphabet letters (A-Z and a-z).
$path = new Path('/a/b/c/d'); echo $path->cd('../x')->currentPath;
should display '/a/b/c/x'.
Note: Do not use built-in path-related functions.
- Example case: Wrong answer
- Two times down: Wrong answer
- Three times up: Wrong answer
- Complex paths: Wrong answer