Supplement the basic strpos() function with an automatic plus one, to make passing it to substr() more simple.
<?php function strposp1(string $haystack, string $needle, int $offset=0) { $pos = strpos($haystack, $needle, $offset); if($pos === FALSE) return FALSE; return ($pos + 1); };
Otherwise +1 must be added to the result of strpos() by hand when using this pattern:
<?php if(str_starts_with($Arg, '--path=')) $Output->Path = substr($Arg, strpos($Arg, '=') + 1); if(str_starts_with($Arg, '--path=')) $Output->Path = substr($Arg, strposp1($Arg, '='));
👍
OPSAT.net
SSL Monitoring | Email Alerts | JSON API