Lemmy.InButts.LOL
  • Communities
  • Create Post
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Dominik@phpc.social to PHP@programming.dev · 1 year ago

Ever wanted to provide your arguments to a function as a comment?

media.phpc.social

message-square
13
link
fedilink
74

Ever wanted to provide your arguments to a function as a comment?

media.phpc.social

Dominik@phpc.social to PHP@programming.dev · 1 year ago
message-square
13
link
fedilink

Ever wanted to provide your arguments to a function as a comment?

https://gist.github.com/RikudouSage/18defbf1746322a289ae78b2980d0115

#php #cursed #wtf #programming @php

alert-triangle
You must log in or # to comment.
  • BatmanAoD@programming.dev
    link
    fedilink
    arrow-up
    31
    ·
    1 year ago

    the function reads the comment added after the function is called using a backtrace and uses them as arguments

    How marvelously creative. What an abomination.

  • shnizmuffinA
    link
    fedilink
    English
    arrow-up
    23
    ·
    1 year ago

    No, my eyes! Forever unclean!

    • Dominik@phpc.socialOP
      link
      fedilink
      arrow-up
      1
      ·
      1 year ago

      @shnizmuffin Mission accomplished!

  • HowManyNimons@lemmy.world
    link
    fedilink
    arrow-up
    18
    ·
    1 year ago

    Do you really want an answer for that?

  • dan@upvote.au
    link
    fedilink
    arrow-up
    17
    ·
    1 year ago

    What a terrible day to have eyes

  • TomasEkeli@programming.dev
    link
    fedilink
    arrow-up
    12
    ·
    1 year ago

    no. never wanted that.

  • zygo_histo_morpheus@programming.dev
    link
    fedilink
    arrow-up
    8
    ·
    edit-2
    11 months ago

    This reminds me of a trick to get multiline strings in javascript before they where formally introduced. If you coerce a function in to a string you get the source code for that function, comments and all. This meant that you could write a function with multiline comments and then pick out the middle part. Haven’t tested it so it’s probably sligthly wrong but it was something like:

    var multiLine = ('' + function () {/*
    line 1
    line 2
    */});
    multiLine = multiLine.substring(16, multiLine.length-4);
    
  • Michael@mstdn.thms.uk
    link
    fedilink
    arrow-up
    5
    ·
    1 year ago

    @chrastecky @php

  • Python@programming.dev
    link
    fedilink
    arrow-up
    4
    ·
    1 year ago

    huh, that does look kinda clean though

    • Dominik@phpc.socialOP
      link
      fedilink
      arrow-up
      6
      ·
      1 year ago

      @python I mean, it’s already an abomination, I can at least write a clean code.

  • CubbyTustard@reddthat.com
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

    deleted by creator

  • THCDenton@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    1 year ago

  • Chao-c'@f.cz
    link
    fedilink
    arrow-up
    1
    ·
    11 months ago

    @chrastecky @php eh, cože? proč?

    • Dominik@phpc.socialOP
      link
      fedilink
      arrow-up
      1
      ·
      11 months ago

      @xChaos @php Někde jsem to viděl, že to někdo dělal pro Python a pobavilo mě to.

PHP@programming.dev

php@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !php@programming.dev

Welcome to /c/php! This is a community for PHP developers and enthusiasts to share and discuss anything related to PHP. From the latest updates and tutorials, to your burning questions and amazing personal projects, we welcome all contributions.

Let’s foster an environment of respect, learning, and mutual growth. Whether you’re an experienced PHP developer, a beginner, or just interested in learning more about PHP, we’re glad to have you here!

Let’s code, learn, and grow together!

Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1 user / day
  • 40 users / week
  • 43 users / month
  • 84 users / 6 months
  • 1 local subscriber
  • 743 subscribers
  • 104 Posts
  • 131 Comments
  • Modlog
  • mods:
  • Ategon@programming.dev
  • mbd@programming.dev
  • BE: 0.19.12
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org