3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait MarkupTrait { /** * The safe string. * * @var string */ protected $string; /** * Creates a Markup object if necessary. * * If $string is equal to a blank string then it is not necessary to create a * Markup object. If $string is an object that implements MarkupInterface it * is returned unchanged. * * @param mixed $string * The string to mark as safe. This value will be cast to a string. * * @return string|\Drupal\Component\Render\MarkupInterface * A safe string. */ public static function create($string) { if ($string instanceof MarkupInterface) { return $string; } $string = (string) $string; if ($string === '') { return ''; } $safe_string = new static(); $safe_string->string = $string; return $safe_string; } } $markup = MarkupTrait::create('foo');
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Calling static trait method MarkupTrait::create is deprecated, it should only be called on a class using the trait in /in/CpIhN on line 39 Fatal error: Uncaught Error: Cannot instantiate trait MarkupTrait in /in/CpIhN:33 Stack trace: #0 /in/CpIhN(39): MarkupTrait::create('foo') #1 {main} thrown in /in/CpIhN on line 33
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
33.17 ms | 406 KiB | 5 Q