Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Prodentim Probiotics Specially Designed For The Health Of Your Teeth And Gums

Instant Grammar Checker - Correct all grammar errors and enhance your writing

Teach Your Child To Read

Powerful WordPress hosting for WordPress professionals

Disclosure: My content contains affiliate links.

31,109 questions

40,780 answers

573 users

How to convert string to int number in PHP

3 Answers

0 votes
$s = "8732";

$n = (int)$s;

echo $n;

  
/*
run: 
 
8732
   
*/ 

 





answered May 10, 2018 by avibootz
0 votes
$s = "8732";

$n = intval($s);     

echo $n;

  
/*
run: 
 
8732
   
*/  

 





answered May 10, 2018 by avibootz
0 votes
$str = "9";

$num = (int)$str;

echo $num;





/*
run:
  
9
  
*/

 





answered Dec 30, 2023 by avibootz

Related questions

2 answers 72 views
1 answer 109 views
1 answer 83 views
1 answer 35 views
...