1
문자열에 임의의 숫자가 있습니다. 그리고 숫자 (또는 문자)를 입력하고 문자열의 위치를 찾고 싶습니다.문자열에서 ascii 번호를 찾으십시오.
나는 다음과 같은 코드를 사용하면 잘 작동 :
<?php
$string='14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196';
$string_to_convert=$_POST["number_to_convert"];
$number_to_find=ord($string_to_convert);
if(strpos($string,$string_to_convert)===false){
echo "not found";
}
else{
echo strpos($string,$string_to_convert)+1;
}
?>
<form method="post" action="">
<input type="textarea" name="number_to_convert"></input>
<input type="submit">
</form>
을하지만이 같은 코드를 사용하려고하면 그것은 찾을 수 없습니다 보여줍니다
<?php
$string='14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196';
$string_to_convert=$_POST["number_to_convert"];
$number_to_find=ord($string_to_convert);
if(strpos($string,$number_to_find)===false){
echo "not found";
}
else{
echo strpos($string,$number_to_find)+1;
}
?>
<form method="post" action="">
<input type="textarea" name="number_to_convert"></input>
<input type="submit">
</form>
이 번호가있는 경우, 일부 이 같은 ISNT 번호가 있으면 임의의 숫자.
그래서 무엇이 잘못 될 수 있습니까?
코드가 잘 작동하는 것 같습니다. http://runnable.com/me/VFpaIkcwbzADRrhK – Chris
"죄송합니다. 보려는 페이지가 없습니다." :) – yamahamm
try this http://runnable.com/VFpbQVz5pPoCf8ww/pi-for-php – Chris