Upvote!
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
Dominik@phpc.social to PHP@programming.dev · 6 months ago

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

media.phpc.social

message-square
12
fedilink
74

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

media.phpc.social

Dominik@phpc.social to PHP@programming.dev · 6 months ago
message-square
12
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
    ·
    6 months 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.

  • shnizmuffin@lemmy.inbutts.lol
    link
    fedilink
    English
    arrow-up
    22
    ·
    6 months ago

    No, my eyes! Forever unclean!

  • HowManyNimons@lemmy.world
    link
    fedilink
    arrow-up
    18
    ·
    6 months ago

    Do you really want an answer for that?

  • danA
    link
    fedilink
    arrow-up
    17
    ·
    6 months ago

    What a terrible day to have eyes

  • TomasEkeli@programming.dev
    link
    fedilink
    arrow-up
    12
    ·
    6 months ago

    no. never wanted that.

  • zygo_histo_morpheus@programming.dev
    link
    fedilink
    arrow-up
    7
    ·
    edit-2
    6 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
    ·
    6 months ago

    @chrastecky @php

  • Python@programming.dev
    link
    fedilink
    arrow-up
    4
    ·
    6 months ago

    huh, that does look kinda clean though

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

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

  • THCDenton@lemmy.world
    link
    fedilink
    arrow-up
    2
    ·
    6 months ago

  • CubbyTustard@reddthat.com
    link
    fedilink
    arrow-up
    2
    ·
    6 months ago

    deleted by creator

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

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

    • Dominik@phpc.socialOP
      link
      fedilink
      arrow-up
      1
      ·
      5 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
  • 1 user / week
  • 12 users / month
  • 175 users / 6 months
  • 1 local subscriber
  • 655 subscribers
  • 84 Posts
  • 155 Comments
  • Modlog
  • mods:
  • Ategon@programming.dev
  • mbd@programming.dev
  • BE: 0.19.6
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org