1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Converting getLore() to a string

Discussion in 'Development' started by minijaham, Aug 3, 2020.

  1. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Hey! Is there a way to convert getLore() function to a string?
     
  2. Primus

    Primus Zombie Pigman

    Messages:
    749
    Item::getLore() returns an string array (string[]). So each element of the array is a string, what you can do to get it together as single string, is to implode it.
    PHP:
    // Implode accepts it's arguments in any order for historical reasons.
    $lore implode($item->getLore(), " ");
     
    minijaham likes this.
  3. minijaham

    minijaham Skeleton

    Messages:
    801
    GitHub:
    minijaham
    Thank you guys so much! Already fixed the issue though,

    that's the code I used xD
     
    Primus likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.