public static fromString ( string $str, boolean $multiple = false ) : |
||
$str | string | |
$multiple | boolean | |
return |
$itemString = "minecraft:diamond_sword"; $item = Item::fromString($itemString);
$itemString = "minecraft:apple:0:1"; $item = Item::fromString($itemString);In this example, the $itemString variable contains a string representation of an apple in Minecraft with a damage value of 0 and a count of 1. The Item::fromString function converts the string into an Item object that can be used in the code. Overall, the Item fromString function is a useful tool for converting string representations of items into Item objects in PHP code in the PocketMine-MP package library.
public static fromString ( string $str, boolean $multiple = false ) : |
||
$str | string | |
$multiple | boolean | |
return |