would like to add a "," after the first two numbers. For example: 2098 -> 20.98; 20398 -> 20,398; 201 -> 20,1; Does anyone know how to do this in php?
You can do it like this: echo preg_replace('/^(..)/', '$1,', '2098'); // 20,98 You can read more about preg_replace here. And regular expressions here.
Thanks for your help!
– Anna Lara Moraes