#PHP, 38 bytes
PHP, 38 bytes
a totally different approach
<?=strpos(strrev(join([0]+$argv)),48);
takes input from command line arguments. Save to file.
[0]+$argv sets the first element (script name) to 0.
Join that without a delimiter, reverse and find the first occurence of the 0 character.
While my first solution works with any truthy and falsy values, this one obviously depends on single characters: 0 is falsy, every other character (apart from maybe the 0 byte) truthy.
#PHP, 38 bytes
a totally different approach
<?=strpos(strrev(join([0]+$argv)),48);
takes input from command line arguments. Save to file.
[0]+$argv sets the first element (script name) to 0.
Join that without a delimiter, reverse and find the first occurence of the 0 character.
While my first solution works with any truthy and falsy values, this one obviously depends on single characters: 0 is falsy, every other character (apart from maybe the 0 byte) truthy.
PHP, 38 bytes
a totally different approach
<?=strpos(strrev(join([0]+$argv)),48);
takes input from command line arguments. Save to file.
[0]+$argv sets the first element (script name) to 0.
Join that without a delimiter, reverse and find the first occurence of the 0 character.
While my first solution works with any truthy and falsy values, this one obviously depends on single characters: 0 is falsy, every other character (apart from maybe the 0 byte) truthy.
#PHP, 38 bytes
a totally different approach
<?=strpos(strrev(join([0]+$argv)),48);
takes input from command line arguments. Save to file.
[0]+$argv sets the first element (script name) to 0.
Join that without a delimiter, reverse and find the first occurence of the 0 character.
While my first solution my first solution works with any truthy and falsy values, this one obviously depends on single characters: 0 is falsy, every other character (apart from maybe the 0 byte) truthy.
#PHP, 38 bytes
a totally different approach
<?=strpos(strrev(join([0]+$argv)),48);
takes input from command line arguments. Save to file.
[0]+$argv sets the first element (script name) to 0.
Join that without a delimiter, reverse and find the first occurence of the 0 character.
While my first solution works with any truthy and falsy values, this one obviously depends on single characters: 0 is falsy, every other character (apart from maybe the 0 byte) truthy.
#PHP, 38 bytes
a totally different approach
<?=strpos(strrev(join([0]+$argv)),48);
takes input from command line arguments. Save to file.
[0]+$argv sets the first element (script name) to 0.
Join that without a delimiter, reverse and find the first occurence of the 0 character.
While my first solution works with any truthy and falsy values, this one obviously depends on single characters: 0 is falsy, every other character (apart from maybe the 0 byte) truthy.
#PHP, 38 bytes
a totally different approach
<?=strpos(strrev(join([0]+$argv)),48);
takes input from command line arguments. Save to file.
[0]+$argv sets the first element (script name) to 0.
Join that without a delimiter, reverse and find the first occurence of the 0 character.
While my first solution works with any truthy and falsy values, this one obviously depends on single characters: 0 is falsy, every other character (apart from maybe the 0 byte) truthy.