I have an HTML which posts a form to a PHP page. The PHP page encodes the password from the form using md5() function. And then I tried to save this MD5 code into a file using fwrite() function.

Here the error occures. fwrite() only accepts string parameter, but the return value of md5() is a number data type.

Can you tell me how can I convert a number to string, or string to number in PHP? (For general purpose. Not for only this problem.)

Can you tell me how can I convert a number to string, or string to number in PHP? (For general purpose. Not for only this problem.)

PHP is not a typed langauge so there is no string or number. A varible is a varible is a varible.

It probaby has something to do with missing qoutes but post the code and this will be a much eaiser question to answer.

I found the answer in documentation.

strval() --> num 2 str
intval() --> str 2 num

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.