Skip to main content

Timeline for And and… and. And.?

Current License: CC BY-SA 4.0

16 events
when toggle format what by license comment
Jul 25, 2020 at 13:17 comment added Ismael Miguel @DomHastings Thank you. I don't think that php -r is a viable option anymore. Or even php -f. Or whichever option has $argn. You would need to do change ${$c[0].rgv}[1]` to ${$c[0].rg.$c[1]}, which is 2 bytes longer. And you would need to change the <?= into echo, which is 3 bytes longer. I think my suggestions are way better too, and yours were as well!
Jul 25, 2020 at 8:18 comment added Dom Hastings @IsmaelMiguel Nice. I did allude to -R too, but your last suggestions are way better than that!
Jul 24, 2020 at 10:00 comment added Ismael Miguel Also, instead of \\0, you can use $0 to save +2 bytes. The final version would look like <?=(preg_repl.($c=XWT^"990")[0].ce)("/\b$c\b/i","$c $0 $c $0 $c",${$c[0].rgv}[1]); (82 bytes). In total, saved 15 bytes from your 97 bytes.
Jul 24, 2020 at 9:41 comment added Ismael Miguel By the way, if you decide to do not use php -r (don't have how to test it, and the Try It Online website is horrible to use) you can just do this instead: <?=(preg_repl.($c=XWT^"990")[0].ce)("/\b$c\b/i","$c \\0 $c \\0 $c",${$c[0].rgv}[1]); which reduces the code to 84 bytes. <?= is the same as <?php echo.
Jul 24, 2020 at 9:20 comment added Ismael Miguel In fact, just removing the variable $b and doing (preg_repl.$c[0].ce) and ${$c[0].rgv}[1] should save you more 2 bytes. The final code will be: <?$c=XWT^"990";echo(preg_repl.$c[0].ce)("/\b$c\b/i","$c \\0 $c \\0 $c",${$c[0].rgv}[1]); (88 bytes). You can try it on: sandbox.onlinephpfunctions.com/code/… (Also, if you use php -r, you might save more bytes)
Jul 24, 2020 at 9:08 comment added Ismael Miguel Instead of <?php $b=chr(97);$c=XWT^"990";, you can do <?$c=XWT^"990";$b=$c[0];. This removes the unnecessary php and the space after (php.net/manual/en/ini.core.php#ini.short-open-tag), and also assigns the first character of $c into $b, saving 2 bytes.
Jul 23, 2020 at 12:02 history edited Scoots CC BY-SA 4.0
deleted 10 characters in body
Jul 23, 2020 at 11:52 comment added Scoots Entirely possible, I may have made an edit or 12 :)
Jul 23, 2020 at 11:51 comment added Dom Hastings So they are, I must've had an older version open!
Jul 23, 2020 at 11:49 comment added Scoots @DomHastings Thanks for the pointers! I don't golf enough to know all the tricks yet :) The directly calling preg_replace as a string occurred to me but the specific syntax eluded me and I foolishly assumed it was impossible, Also the quotes around "rgv" are only there in my ungolfed version.
Jul 23, 2020 at 11:48 history edited Scoots CC BY-SA 4.0
added 511 characters in body
Jul 23, 2020 at 11:47 comment added Dom Hastings You can also skip the quotes around "rgv" :)
Jul 23, 2020 at 11:42 comment added Dom Hastings Nice work! You can save a few bytes though: you don't need to define $e=preg_repl.$b.ce, you can just use echo(preg_repl.$b.ce)(...) directly. You can avoid the capture ($c) in your regex and use \\0 to get the contents instead. You can also use stringwise XOR to get and via $c=XWT^"990" (or many other strings!) and either $b=$c[0] or $b=X^"9" to get the a. I can't find a way to get it working on without calling PHP manually via Bash, but you should be able to use -R to skip the <?php and use $argn instead of $argv[1] for some more savings, but that might be too far!
Jul 23, 2020 at 11:34 history edited Scoots CC BY-SA 4.0
deleted 3 characters in body
Jul 23, 2020 at 11:25 history edited Scoots CC BY-SA 4.0
deleted 46 characters in body
Jul 23, 2020 at 11:19 history answered Scoots CC BY-SA 4.0