Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#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.

replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
Source Link

#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.

Source Link
Titus
  • 14.9k
  • 1
  • 25
  • 41

#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.

AltStyle によって変換されたページ (->オリジナル) /