Prepending 0 in Folder Structure

Is there way to prepend a “0” before the project number within the folder structure? I’m using “<?php echo $project->num() ?>” so I can display the number of the project with the project title, and I want to make sure that the first 9 projects have a prepended 0 to ensure character consistency. I notice the content file structure on the one-pager kirby tutorial ( all has “0” prepended on single digit numbers — I’d like to do this so that I can sort projects in the kirby panel without having it automatically change back to single digits. Thanks!

Do you need this in your filenames? Or only for your fronted code?

For your site, try to use:
str_pad($project->num(), 1, "0", STR_PAD_LEFT);
This should add one “0” if needed to your string for your number.

(It´s only a short google search, I had no time to test this yet.)

This works, thank you! For future reference, should use “2” for the length parameter:

str_pad($project->num(), 2, "0", STR_PAD_LEFT);