Hello everybody, I new with PHP but eager to learn. I've just installed PHP5, MySQL5 and Apache2 in my desktop. I have tested them according to the manual and it was okay. I started to get to know with PHP by reading and testing the language by following the php manual. But when it comes to function I found out that it didn't work. Nothing happen in the browser. I gave you one example here: <?php $money1 = 68.75; $money2 = 54.35; $money = $money1 + $money2; // echo $money will output "123.1"; $formatted = sprintf("%01.2f", $money); // echo $formatted will output "123.10" ?> Is it because my PHP installation is not complete with function? Anyone here is willing to share knowledge, first of all I would like to say thank you.
some functions dont work with the desktop installation try upload to a website sot test thats what i do
I'm very sorry. Actually my problem is like this, I mix the PHP with XHTML and the codes is as below: <!DOCTYPE html PUBLIC "-//W3C//DTD/XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml11-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>A Web Page</title> </head> <body> <p> <?php $money1 = 68.75; $money2 = 54.35; $money = $money1 + $money2; // echo $money will output "123.1"; $formatted = sprintf("%01.2f", $money); // echo $formatted will output "123.10" echo $formatted; ?> </p> </body> </html> And nothing happend in the browser. But when I coded it without XHTML as below: <?php $money1 = 68.75; $money2 = 54.35; $money = $money1 + $money2; // echo $money will output "123.1"; $formatted = sprintf("%01.2f", $money); // echo $formatted will output "123.10" echo $formatted; ?> The output in the browser is just like that: 123.10 I wonder why?
Well my advice is to uninstall and install WAMPServer or something similar - it's all of them, and it's set up for the purpose - much easier to manage, everything'll work, you can install PEAR and such easily...
yeah - it's for windows. WAMP stands for Windows Apache Mysql PHP. I personally use WAMPServer (wampserver.com/en/) on my laptop, but I think XAMPP (apachefriends.org/en/xampp.html) is probably the most popular one. You can use multiple versions of php and mysql by downloading a package and installing it, then you can switch between different versions at the click of a button.