Binary string testing... - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of Binary string testing....php
- <?php
- function estBinaire($chaine) {
- $bin=true;
- for ($i=0; $i<strlen($chaine); $i++) {
- if (!(($chaine[$i]=='0') || ($chaine[$i]=='1'))) {
- $bin=false;
- }
- }
- if ($bin==true) {
- echo 'BINAIRE'."\n";
- } else {
- echo 'NON BINAIRE'."\n";
- }
- }
- estBinaire('11001');
- estBinaire('101010010010a010101010');
- estBinaire('1');
- estBinaire('0');
- estBinaire('11201');
File Description
- Binary string testing...
- PHP Code
- 12 Dec-2019
- 495 Bytes
You can Share it:
Latest PHP Pastes