Originally published on php2rust.dev — part of the PHP to Rust course. View this lesson on the original site.

What makes Rust stand out, especially when you're coming from PHP, is the combination of performance, safety, and expressiveness. Here we'll briefly unpack each so you know what to expect as you learn.

Performance

Rust is in the same performance ballpark as C and C++, with no garbage collector. In PHP you're used to the runtime managing memory and occasional GC pauses; in Rust there are no GC pauses, and memory use is predictable. That doesn't mean every Rust program is faster than every PHP program, but when you need to handle more requests per server, process large datasets, or keep latency tight, Rust gives you the tools without leaving the language.

Many PHP teams use Rust for the hot path (e.g. a microservice or CLI) while keeping the rest of the stack in PHP. You get the same kind of "right tool for the job" thinking you already use when choosing between PHP, SQL, and front-end code.

Type system

Rust has strong static typing and type inference: you write types where they clarify intent, and the compiler fills in the rest. The important part is that type checking happens at compile time. In PHP you can add union types, return types, and strict types, but it's optional and enforcement happens when the code runs. In Rust, the compiler refuses to build your program if types don't line up, so a whole class of bugs never reaches production.

If you've enjoyed PHP 8's stricter typing, Rust will feel like that idea taken further: no mixed, no accidental nulls (unless you opt in with Option), and the compiler as a permanent code reviewer for types and many logic errors.

Concurrency

Rust is designed for safe concurrency. In PHP you typically scale with separate processes, workers, or queues; in Rust you can use threads and async I/O with rules enforced by the compiler. The type system and ownership model prevent data races at compile time, you can't accidentally share mutable state between threads in an unsafe way.

That's useful for long-running services (APIs, job processors, real-time backends) where you want many tasks in progress without the "shotgun debugging" that often comes with shared state in other languages. We'll touch on concurrency later in the course; for now it's enough to know that Rust gives you concurrency without the usual footguns.

Expressiveness

Rust offers structs, enums, pattern matching, and traits, ways to model your domain and express intent clearly. If you've used PHP's classes, interfaces, and type hints, you'll recognise the goal: clear data shapes and behaviour. The syntax is different, but the ideas map over.

  • Structs are like PHP classes that hold data (and can have methods).
  • Enums are more powerful than PHP's enums: variants can carry data, and pattern matching on them replaces a lot of conditionals and switch statements.
  • Traits are similar to interfaces: they define behaviour that types can implement.
  • Pattern matching gives you a concise way to branch on the shape of data (which enum variant, which fields, etc.) and the compiler checks that you've covered the cases.

Together, these let you write code that reads clearly and that the compiler can check thoroughly, fewer null checks and defensive conditionals, more structure and safety.


These four pillars, performance, type system, concurrency, and expressiveness, are what people mean when they talk about Rust's design. You don't have to master them on day one. As you work through the course, you'll see how they connect to what you already know from PHP and how they shape the way you write Rust.

Beyond the language itself, Rust has a standard toolkit and a growing ecosystem of libraries. Next we'll take a quick tour.

What's next

Dipping our toes into the Rust ecosystem.

From PHP to Rust — Getting Started with Rust