Ad
  • Custom User Avatar

    I keep forgetting this is a thing. Thank you coders for reminding me.

    As per "best practice"... I'm not certain how PHP handles its symbol tables, but considering the new function we are making just calls another function and returns it... it seems like a better practice to just handle it as a namespace import... as that is pretty much all it is

  • Custom User Avatar

    I like it - but would this be considered best practice? Very clever indeed :)

  • Custom User Avatar
  • Custom User Avatar

    Missing PHP example within description

  • Custom User Avatar

    I forgot the floor() try to re-submit test pass but I don't have the 'final submit'

  • Custom User Avatar

    Hi,

    the javascript tests and the php are exactly the same.

        public function testMysteryFunction() {
            //a+b?
            $this->assertEquals(1,testit(0,1), "test a=0, b=1");
            $this->assertEquals(3,testit(1,2), "test a=1, b=2");
            $this->assertEquals(30, testit(10,20), "test a=10, b=20");
            //a*b?
            $this->assertEquals(1,testit(1,1), "test a=1, b=1");
            $this->assertEquals(3, testit(1,3), "test a=1, b=3");
            //try "Submit" find more...
        }
    

    You're right, the runner run only one testcase the testMysteryFunction with the same tests as the js, It's a kind of Describe(..). But I can make 5 sub-testcase.
    the server side test have 2 testcases (all the Test.assert, and 100 hundred random tests).

    thanks. I going to check the others translated katas in php.

  • Custom User Avatar

    Hi,

    your Php version looks not good, only one testcase?

  • Custom User Avatar

    Hello

    Php version Submitted

    Try to add some print and echo, but the it's break the test and it's failed with Kumite was published with failed tests!with 0 errors and 0 passeds.

    Thanks !

  • Default User Avatar

    Approved, thanks!

  • Custom User Avatar

    Thanks for your review.

    All your remarks are rights and I fixed them:

    • The tabulations are invisibles on the online editor.(but in vim-mode :/\t highlight them )
    • The expected and the actual are reverteds I translated a little bit to fast the javascript. I'll fix my other katas.

    Again thank for spend some time.

  • Default User Avatar

    I am ready to approve your translation but I would like you to do 2 small improvements:

    • in "Solution Setup": something like "return ..." or "// Your code" rather than "return $n" which is a bit misleading...
    • in the tests there is a bad indentation, it does no harm but it would be better to correct it if possible.
    • I'm afraid that in the tests you swapped "actual" and "expected".

    Thanks for your help.

  • Default User Avatar

    It's my first PHP approval. It caught me off guard that codewars has PHP now, which is awesome, but it still missing some crucial modules (e.g. the multibyte-string lib).

    Also, thank you for submitting it.

  • Custom User Avatar

    Your solution is clearly better. I didn't known the ucwords instruction

    I am sorry. it's my second translation.

    thank you for approve it.

  • Default User Avatar

    Aww... it's attributing my forked solution to you. Oh well.

  • Custom User Avatar

    Add the php translation

    please accepts. thanks.

  • Loading more items...