Hello everybody,
I'm Michele and I'm from Italy.

I started coding a few weeks ago and I'm still a novice in this field, so I hope to get help from those who have more experience than me to learn something new!

My problem is this:

I am creating an ecommerce based on WordPress and I'm trying to automate the whole phase of import of products through WP All Import.

I could fit almost anything and I miss only this small piece. As you can see from the picture below, the "calet" field is imported with a comma and a zero, and this creates import problems. Besides eliminating ",0" from that field should I do also another operation. The "calet" field must always be 3 digits, so if for example I have a value of "12" has to become "012", if I have a value of "5" should be "005" and if I have a value of "125" it will remain unchanged.
I wrote the following function but does not seem to work, what is wrong?

PHP Code:
PHP Code:
function stringhizza_pneudirect($var

$quantity trim($var); 
$quantity str_replace(",0"''$quantity); 
intval($var) . ''

$lunghezza strlen($var); 

$lunghezza == 3

$lunghezza == 2

$var '0'.$var

$lunghezza == 1

$var '00'.$var


Are days that I try to solve this problem but I can't... I thank in advance anyone who can help me out!
Name:  1111.jpg
Views: 92
Size:  18.6 KB