html - PHP Reverse not working -


i'm trying reverse string , add spaces 3 in 3 characters code have right this:

$rowpreco = "925000"    $rowpreco = strrev($rowpreco); $rowpreco = wordwrap($rowpreco , 3 , ' ' , true ); $rowpreco = strrev($rowpreco); 

if take strrev out prints how want ("925 000") if have strrev print ("92 500 0").

but need use strrev because if value ("1200000") print ("120 000 0") instead of ("1 200 000").

any appreciated.

thanks!

update!

when use number_format ignore jquery code have.

echo "<script>"           ."jquery(document).ready(function() {"           ."var parts = jquery('.casapreco').text().split('|');"           ."jquery('.casapreco2').text(parts[4]);"           ."});"           ."</script>"; 

basically initial string this: "3880562|1|1|925000|||0|0|0"

i need grab 4th number i'm splitting string on "|" , use array parts[4] when use number_format grab number "3880562"

please not invent wheel:

echo number_format('925000', 0, '.', ' ');   // 925 000 echo number_format('1200000', 0, '.', ' ');  // 1 200 000 

number_format manual.


Comments

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -