当前位置:网站首页>Convert Boolean to integer value PHP - Convert Boolean to integer value PHP

Convert Boolean to integer value PHP - Convert Boolean to integer value PHP

2022-07-05 04:08:00 fyin1314

problem :

Is there any builtin function for PHP that will take a boolean value and return its integer equivalent?PHP Is there any built-in function that will take a Boolean value and return its equivalent integer ?0 for FALSE, 1 for TRUE?0 representative FALSE,1 representative TRUE?Of course you can easily create a function to do so, I'm just asking if there is a builtin function inside of PHP. Of course, you can easily create a function to do this , I'm just asking PHP Is there a built-in function inside .I already tried intval() and casting it to (int) but they didnt work, they return 0 in both cases of TRUE and FALSE. I've tried intval() And convert it to (int) But they don't work , They are TRUE and FALSE Return in both cases 0.

Edit : the problem was that it wasnt really a boolean, it was a string "false", "true", php didnt detect the jquery post that it passed a boolean. edit : The problem is that it's not really a Boolean , It's a string “false”、“true”,php It was not detected that it passed a Boolean jquery post .problem solved, thanks ! Problem solved , thank you !


Solution :

Reference resources : https://stackoom.com/en/question/1MEFY
原网站

版权声明
本文为[fyin1314]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140705245414.html