3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo"<script language='javascript'> (function ($) /* Wraps this `$ = jQuery` routine. */ { $.fn.swapWith = function (to) /* Utility extension for jQuery. */ { return this.each(function () { var $to = $(to).clone(true), $from = $(this).clone(true); $(to).replaceWith($from), $(this).replaceWith($to); }); }; /**/ $(document).ready(function () /* Handles email-to-username on keyup. */ { var email = 'input#user_email', login = 'input#user_login'; $(email).closest('p').swapWith($(login).closest('p')), $(email).keyup(function () { $(login).val($.trim($(email).val().split(/@/)[0].replace(/[^\w]/gi, ''))); }); }); })(jQuery); </script> "; ?>
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: Undefined variable $to in /in/7Cdia on line 8 Warning: Undefined variable $from in /in/7Cdia on line 9 Warning: Undefined variable $from in /in/7Cdia on line 10 Warning: Undefined variable $to in /in/7Cdia on line 10 <script language='javascript'> (function ($) /* Wraps this `$ = jQuery` routine. */ { $.fn.swapWith = function (to) /* Utility extension for jQuery. */ { return this.each(function () { var = $(to).clone(true), = $(this).clone(true); $(to).replaceWith(), $(this).replaceWith(); }); }; /**/ $(document).ready(function () /* Handles email-to-username on keyup. */ { var email = 'input#user_email', login = 'input#user_login'; $(email).closest('p').swapWith($(login).closest('p')), $(email).keyup(function () { $(login).val($.trim($(email).val().split(/@/)[0].replace(/[^\w]/gi, ''))); }); }); })(jQuery); </script>
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.6 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined variable: to in /in/7Cdia on line 8 Notice: Undefined variable: from in /in/7Cdia on line 9 Notice: Undefined variable: from in /in/7Cdia on line 10 Notice: Undefined variable: to in /in/7Cdia on line 10 <script language='javascript'> (function ($) /* Wraps this `$ = jQuery` routine. */ { $.fn.swapWith = function (to) /* Utility extension for jQuery. */ { return this.each(function () { var = $(to).clone(true), = $(this).clone(true); $(to).replaceWith(), $(this).replaceWith(); }); }; /**/ $(document).ready(function () /* Handles email-to-username on keyup. */ { var email = 'input#user_email', login = 'input#user_login'; $(email).closest('p').swapWith($(login).closest('p')), $(email).keyup(function () { $(login).val($.trim($(email).val().split(/@/)[0].replace(/[^\w]/gi, ''))); }); }); })(jQuery); </script>
Output for 7.3.32 - 7.3.33
<script language='javascript'> (function ($) /* Wraps this `$ = jQuery` routine. */ { $.fn.swapWith = function (to) /* Utility extension for jQuery. */ { return this.each(function () { var = $(to).clone(true), = $(this).clone(true); $(to).replaceWith(), $(this).replaceWith(); }); }; /**/ $(document).ready(function () /* Handles email-to-username on keyup. */ { var email = 'input#user_email', login = 'input#user_login'; $(email).closest('p').swapWith($(login).closest('p')), $(email).keyup(function () { $(login).val($.trim($(email).val().split(/@/)[0].replace(/[^\w]/gi, ''))); }); }); })(jQuery); </script>
Output for 5.4.1 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Notice: Undefined variable: to in /in/7Cdia on line 9 Notice: Undefined variable: from in /in/7Cdia on line 10 Notice: Undefined variable: from in /in/7Cdia on line 10 Notice: Undefined variable: to in /in/7Cdia on line 24 <script language='javascript'> (function ($) /* Wraps this `$ = jQuery` routine. */ { $.fn.swapWith = function (to) /* Utility extension for jQuery. */ { return this.each(function () { var = $(to).clone(true), = $(this).clone(true); $(to).replaceWith(), $(this).replaceWith(); }); }; /**/ $(document).ready(function () /* Handles email-to-username on keyup. */ { var email = 'input#user_email', login = 'input#user_login'; $(email).closest('p').swapWith($(login).closest('p')), $(email).keyup(function () { $(login).val($.trim($(email).val().split(/@/)[0].replace(/[^\w]/gi, ''))); }); }); })(jQuery); </script>

preferences:
199.39 ms | 404 KiB | 223 Q