Search the Community
Showing results for tags 'syntax'.
-
$ARR[$i] == $NEEDLE ? $Count++ : $Count I am using it in: private function _countIf($ARR, $NEEDLE){ $Count = 0; for($i = 0; $i < count($ARR); i++){ $ARR[$i] == $NEEDLE ? $Count++ : $Count } return $Count; }
-
ok... I'm still struggling with PHP syntax, my editor's linting keeps flagging a line as incorrect. it's supposed to read as " when d1 minus 1 is less than or equal to d2 with d2 being less than or equal to d1 plus 1" so in other words its supposed to be true if d2 is between d1 minus 1 and d1 plus 1, inclusive. I don't want d2 being the previous number, the same number or the next number relative to d1. The same goes for d3, d4, and d5 (4 and 5 are un coded because why code in errors). That being said... This isn't exactly my correct goal but I'm not sure how to code what I really want... Rules a 3 - 5 digit combo (0 - 99 per digit) where: 1. the numbers are not in order. (1,2,3,4 or 55,56,57,58,59 or 4,3,2,1 or 59,58,57,56,55) 2. no more than 2 numbers in the combo may be the same. (45,12,67,12,78 is ok 17,35,17,24,17 is not) 3. repeat numbers may not occur next to each other (45,12,67,12,78 = valid 45,67,12,12,78 = invalid) I can't seem to find a good way to test this without the commands I know from other languages like CountIf, Iffn and RandSamp. (those are Ti-Basic commands) I know "please do it for me" is frowned upon, and hate saying it (I'd rather learn to do it myself), but if anyone can explain how to do this I'd really appreciate it.
-
I am using this API https://github.com/blocktrail/blocktrail-sdk-php. I am suppose to add this to top of my directory where I want to initialize the API. require 'vendor/autoload.php'; use Blocktrail\SDK\BlocktrailSDK; But the second line gives me an error. use Blocktrail\SDK\BlocktrailSDK; Parse error: syntax error, unexpected 'use' (T_USE) in C:\xampp\htdocs\site\templates\header.php on line 12 Is the "use" a correct syntax for php? Why is it giving me an error?