I have this line of code...
$ide=str_replace('idEdu=', '', $_SERVER['QUERY_STRING']);
In which i get a string which is always a number and I want this string to make it integer.
I want to get for example the number 3 for the url which can be like this one addCV.php?idEdu=3
Can you help me please to achieve that? Thank you
You can either cast as int or use intval():
$num=(int)$_GET['idEdu'];
or
$num=intval($_GET['idEdu']);
Casting should be 4 times as fast.
你有没有尝试过?
$ide = intval(str_replace('idEdu=', '', $_SERVER['QUERY_STRING']));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.