Ryan Chandler is adding new videos to Rust for PHP Developers, his paid course at rustforphp.dev, and says they reach every plan. The batch covers error handling, trait objects and dyn, closures and concurrency.
Those four topics are where a PHP developer first gets stuck in Rust, so I turned each one into a task for Codex: take a PHP script, port it to Rust and match the output byte for byte. Codex passed all five tasks I gave it, including a fix for three borrow-checker errors, and every project finished with no clippy warnings. On the one speed test, a prime counter, the four-thread Rust port ran about twelve times faster than the PHP script.
That’s a smoke test on five small programs, so read it as a picture of what Codex handles well and not as a score.
5 of 5
Codex tasks passed
0
clippy warnings left
0.13 s
Rust on four threads, against 1.6 s for PHP
What Ryan announced
Ryan says the new videos on error handling, trait objects and dyn, closures and concurrency are on the way, and that all the new content is available regardless of plan. That matters because of how the course page sells access. It lists three one-time plans, shown in dollars and excluding VAT and local charges. Standard is $99 and includes the launch modules. Premium is $149 and Full Monty is $199, and only those two include future module and content updates. Full Monty adds the source code for every project. Under the page’s own terms a Standard buyer would miss new videos, so Ryan’s note widens access for that plan.

The course is built for PHP developers. Its FAQ says the videos draw comparisons between the two languages and are mostly live coding, with lengths from about three minutes to twenty. The outline today runs to ten modules, from the basics through pattern matching, ownership, traits and generics to smart pointers, and the six videos in the first module are free.
Why these four topics
Each new topic swaps a PHP habit for a Rust one. Exceptions become values you return and pass up with the question mark operator. An interface you type-hint against becomes a trait, and a list of mixed objects becomes a vector of boxed trait objects. A closure that captures variables with use becomes a closure whose captures the compiler tracks. Threads are the biggest jump, because PHP code normally runs on one thread and Rust makes you say how data is shared.

How I tested it
Everything ran on one cloud VM with 4 vCPUs (Intel Xeon at 2.30 GHz), 15 GiB of memory, a 252 GB disk and Ubuntu 24.04.5 on Linux 6.18. The toolchain was PHP 8.3.6 and Rust 1.97.0 with Cargo and Clippy. Codex CLI 0.174.0 was signed in with a ChatGPT login and used GPT-6.2 Sol, its default model.
I wrote four PHP scripts, one per topic, and ran each with php to record the expected output. The fifth task is a small Rust crate whose tests don’t compile. Each task ran once with codex exec in a project directory holding only the task files, and I made no edits to what Codex wrote. The check afterwards was the same every time: cargo run against the expected output, then cargo clippy.
The first task is a config parser that throws exceptions:
This directory has config.php. Port it to Rust as a Cargo project in this directory, using only the standard library. The program's output must match `php config.php` byte for byte. Replace the exception classes with a custom error enum and use the ? operator. Then run cargo clippy and fix every warning. Finish by writing NOTES.md, at most six lines, comparing each Rust feature you used to its PHP equivalent.
The second is a list of shapes behind an interface, sorted and totalled by type:
This directory has shapes.php. Port it to Rust as a Cargo project in this directory, using only the standard library. The program's output must match `php shapes.php` byte for byte. Use a trait for Shape and store the shapes as Vec<Box<dyn Shape>>. Then run cargo clippy and fix every warning. Finish by writing NOTES.md, at most six lines, comparing each Rust feature you used to its PHP equivalent.
The third has counters, a pipeline and a callable that takes any number of arguments:
This directory has closures.php. Port it to Rust as a Cargo project in this directory, using only the standard library. The program's output must match `php closures.php` byte for byte. Use real closures, with impl Fn or Box<dyn Fn> where a closure is returned. Then run cargo clippy and fix every warning. Finish by writing NOTES.md, at most six lines, comparing each Rust feature you used to its PHP equivalent.
The fourth counts primes below two million in four ranges:
This directory has primes.php. Port it to Rust as a Cargo project in this directory, using only the standard library. The program's output must match `php primes.php` byte for byte. Run the four ranges on four std::thread threads, share the running total through Arc<Mutex<u64>>, and still print the range lines in order. Then run cargo clippy and fix every warning. Finish by writing NOTES.md, at most six lines, comparing each Rust feature you used to its PHP equivalent.
The last is the broken crate, with three functions a PHP developer would write without thinking:
cargo test in this directory fails to compile. Fix src/lib.rs so that cargo test passes. Don't edit the tests and don't change any function signature. Then run cargo clippy and fix every warning. Finish by writing NOTES.md, at most six lines, explaining each of the three compile errors in terms a PHP developer would recognise.
What Codex did
All five runs finished in 27 to 43 seconds. The four ports matched PHP’s output byte for byte, the ownership crate’s three tests passed, and clippy had nothing to say about any project.
| Task | Rust feature | Result |
|---|---|---|
| Config parser | Error enum and ? | Output matches PHP |
| Shapes | Vec<Box<dyn Shape>> | Output matches PHP |
| Closures | impl Fn, Cell, function pointers | Output matches PHP |
| Prime counter | thread::spawn, Arc<Mutex<u64>> | Output matches PHP |
| Broken crate | Moves, borrows, lifetimes | Three tests pass |

The error handling port swapped the exception classes for a ConfigError enum and used the question mark operator where PHP throws. It also copied two PHP quirks that nobody asked for. PHP’s trim() strips six characters, so Codex wrote a trim that strips the same six. A port number too big for a 64-bit integer clamps to the maximum in PHP, so Codex used saturating arithmetic to match.

The shapes port is the textbook answer: a Shape trait, a vector of boxed trait objects, sort_by with total_cmp where PHP has usort, and a BTreeMap where PHP has ksort.
In the closures port, Codex returned closures with impl Fn and used a Cell to keep the counter mutable inside an Fn closure. PHP’s variadic callable became an array of function pointers, with fold standing in for array_reduce.
The threads port gives each range its own thread and adds each count to the shared total behind a mutex. The main thread joins the handles in order, which is why the range lines still print in order. Here is the core of it:
let total: Arc<Mutex<u64>> = Arc::new(Mutex::new(0));
let mut workers = Vec::new();
for part in 0..parts {
let lo = part * chunk;
let hi = if part == parts - 1 { limit } else { (part + 1) * chunk };
let total = Arc::clone(&total);
workers.push(thread::spawn(move || {
let mut count = 0;
for n in lo..hi {
if is_prime(n) {
count += 1;
}
}
*total.lock().expect("total mutex poisoned") += count;
(lo, hi, count)
}));
}
for (part, worker) in workers.into_iter().enumerate() {
let (lo, hi, count) = worker.join().expect("prime worker panicked");
println!("range {} [{lo}, {hi}): {count}", part + 1);
}
The broken crate had three compile errors. One function used a vector after moving it into a variable, one pushed onto a string through a shared reference, and one returned a slice of a string that is freed when the function ends. Codex fixed all three and left the tests alone. The prompt froze the function signatures, and Clippy would rather take a slice than a reference to a vector, so Codex kept the signatures and marked that lint as allowed on the two functions it touches. Its NOTES.md explained each error in PHP terms. One example: PHP arrays copy on write, while Rust’s assignment moves the vector.
How much faster the Rust is
The PHP script and the Rust port do the same work, counting primes by trial division, and print the same 163 bytes. PHP ran it on one thread. The Rust port is a release build on four. Across three runs of each, the median was 1.6 seconds for PHP and 0.13 seconds for Rust. That’s a smoke test of one program on one machine, and the gap mixes the language with the extra threads.

The recording
This is the real Codex terminal on the same VM. The first prompt fixes the broken crate and the second ports the prime counter. Waiting stretches are fast-forwarded, and the prompts and results run at normal speed.
In ownership/, cargo test fails to compile. Fix src/lib.rs so that cargo test passes. Don't edit the tests and don't change any function signature. Then run cargo clippy and fix every warning.
Now port primes.php to Rust as a Cargo project in a new directory called primes/, using only the standard library. The output must match `php primes.php` byte for byte. Run the four ranges on four std::thread threads, share the running total through Arc<Mutex<u64>>, and still print the range lines in order. Then run cargo clippy and fix every warning.
Where this sits next to the course
A port shows you idiomatic Rust beside PHP you already know, and Codex’s NOTES.md files read like a short glossary. They don’t explain why the compiler objects to a pattern, or when a trait object beats a generic. That’s the part a course is for. The Rust Programming Language, the free book on the Rust project’s site, covers the same ground, and a version from Brown University adds quizzes and visualisations. Ryan’s course is the PHP-shaped route through the same material.
Try it yourself
The download holds the PHP scripts with their expected output, the broken crate, the five prompts and Codex’s output without build files. To repeat a run, copy a script into an empty directory and pass the matching prompt to codex exec.
Sources
- Rust for PHP Developers, course page, outline, pricing and FAQ
- The Rust Programming Language and the Brown University edition
- OpenAI Codex CLI
Disclosure: I’m an OpenAI, Firecrawl and Devin ambassador.




