3v4l.org

run code in 300+ PHP versions simultaneously
<?php $text = <<<'TEXT' <?php /** * Name: Offerte bekijken * * @var \Cake\View\View $this * @var \App\Model\Entity\Quote $quote Quote to show * @var \App\Model\Entity\QuoteType $chosenQuoteType Chosen Quote Type * @var \App\Model\Entity\QuoteCalculationsPackage $chosenQuotePackage Chosen Quote Package * @var string $chosenQuoteTemplate Template (rent, buy, a1k, a1h) */ use App\Controller\Calculator\SavingsA1H; use Cake\Chronos\Chronos; /* * Variables to load: * * $quote->package->name * $chosenQuotePackage->package->name * $chosenQuotePackage->package->panel->wp * $quote->package->panel->wp * $chosenQuotePackage->inverter->inverter_type->name * $chosenQuotePackage->inverter->brand->name */ $quote_type_id = $quote->quote_type_id; $this->assign( 'title', 'Uw persoonlijke offerte van Zelfstroom' ); if ( empty( $extraCalculations ) ) { $extraCalculations = []; } ?> <?= $this->Cell( 'Header', [ $quote, $chosenQuoteType ] ); ?> <?php if ( ! isset( $isPdf ) || ! $isPdf ): echo $this->Cell( 'PingPong', [ $quote->id ] ); endif; ?> <?= $this->Html->script( [ "https://code.jquery.com/ui/1.11.4/jquery-ui.min.js", "bootstrap/bootstrap.min.js", "Bootgrid.moment-with-locales.min.js", "datepicker-nl.js", "jquery.datetimepicker.full.min.js", "jquery.validate.min.js", ], [ 'block' => 'scriptBottom' ] ); ?> <?= $this->Html->css( [ 'bootstrap/bootstrap.css', 'appointment_calendar.css', "jquery.datetimepicker.min.css", ] ); ?> <?= $this->fetch( 'css' ) ?> <?= $this->fetch( 'script' ) ?> <main class="site-content"> <div class="container"> <section class="section section--white section--intro"> <div class="row"> <div class="col-xs-12 col-sm-10 col-sm-offset-1 center"> <header> <h1><?= sprintf( __( 'Personal quote for %s' ), $quote->quote_request->contact->fullname ); ?></h1> </header> <figure class="small cover-image"> <?= $this->Html->image( '/' . $quote->image_street, [ 'alt' => __( '' ), 'fullBase' => true ] ) ?> </figure> <div class="body"> <p><?= $quote->custom_text_intro; ?></p> <footer> <span><?= __( 'Your Zelfstroom advisor' ); ?></span> <span class="advisor"><?= $quote->sales_advisor->fullname; ?></span> </footer> </div> </div> </div> </section> <?php $cellSectionSavings = $this->Cell( 'FrontendSectionSavings', [ $quote, $chosenQuotePackage, $extraCalculations, $chosenQuoteType ] ); $cellSectionSavings->template = $chosenQuoteTemplate; $cellSectionPackage = $this->Cell( 'FrontendSectionPackage', [ $quote, $chosenQuotePackage, $extraCalculations, $chosenQuoteType ] ); $cellSectionPackage->template = $chosenQuoteTemplate; $cellSectionGuarantees = $this->Cell( 'FrontendSectionGuarantees', [ $quote, $chosenQuotePackage, $extraCalculations, $chosenQuoteType ] ); $cellSectionGuarantees->template = $chosenQuoteTemplate; $cellSectionNewPlan = $this->Cell( 'FrontendSectionNewPlan', [ $quote, $chosenQuotePackage, $extraCalculations, $chosenQuoteType ] ); $cellSectionNewPlan->template = $chosenQuoteTemplate; echo $cellSectionSavings; echo $cellSectionPackage; echo $cellSectionGuarantees; echo $cellSectionNewPlan; ?> <?php if ( $chosenQuoteTemplate == 'rent' || $chosenQuoteTemplate == 'a1h' ) { ?> <section class="section section--orange-light section--process"> <div class="row"> <div class="col-xs-12 col-sm-10 col-sm-offset-1 center"> <header> <h2><?= __( 'How to continue' ); ?></h2> </header> <div class="row cta cta--dots"> <div class="col-sm-6 col-md-2 col-sm-offset-0 col-md-offset-1 cta__item__rent"> <figure> <?= $this->Html->image( '/frontend/dist/images/icon-search.svg', [ 'alt' => __( '' ), 'fullBase' => true ] ) ?> </figure> <header> <h4 data-edit="true" data-type="wysiwyg" data-name="Beoordeling">We beoordelen uw aanvraag en berichten u over de acceptatie daarvan.</h4> </header> </div> <div class="col-sm-6 col-md-2 cta__item__rent"> <figure> <?= $this->Html->image( '/frontend/dist/images/icon-phone-dial.svg', [ 'alt' => __( '' ), 'fullBase' => true ] ) ?> </figure> <header> <h4 data-type="text" data-edit="true" data-name="Bellen">We bellen u voor een afspraak.</h4> </header> </div> <div class="col-sm-6 col-md-2 cta__item__rent"> <figure> <?= $this->Html->image( '/frontend/dist/images/icon-technical.svg', [ 'alt' => __( '' ), 'fullBase' => true ] ) ?> </figure> <header> <h4 data-edit="true" data-type="text" data-name="Technisch specialist">Technisch specialist neemt <strong>bij u</strong> alles nog even door.</h4> </header> </div> <div class="col-sm-6 col-md-2 cta__item__rent"> <figure> <?= $this->Html->image( '/frontend/dist/images/icon-house.svg', [ 'alt' => __( '' ), 'fullBase' => true ] ) ?> </figure> <header> <h4>Installatie van de panelen in 1 dag.</h4> </header> </div> <div class="col-sm-6 col-md-2 cta__item__rent"> <figure> <?= $this->Html->image( '/frontend/dist/images/icon-bolt.svg', [ 'alt' => __( '' ), 'fullBase' => true ] ) ?> </figure> <header> <h4>Over enkele weken maakt u zelf stroom</h4> </header> </div> </div> </div> </div> </section> <?php } else { ?> <section class="section section--orange-light section--process"> <div class="row"> <div class="col-xs-12 col-sm-10 col-sm-offset-1 center"> <header> <h2><?= __( 'How to continue' ); ?></h2> </header> <div class="row cta cta--dots"> <div class="col-xs-6 col-sm-3 cta__item"> <figure> <?= $this->Html->image( '/frontend/dist/images/icon-phone-dial.svg', [ 'alt' => __( '' ), 'fullBase' => true ] ) ?> </figure> <header> <h4>We bellen u voor een afspraak.</h4> </header> </div> <div class="col-xs-6 col-sm-3 cta__item"> <figure> <?= $this->Html->image( '/frontend/dist/images/icon-technical.svg', [ 'alt' => __( '' ), 'fullBase' => true ] ) ?> </figure> <header> <h4>Technisch specialist neemt bij u alles nog even door.</h4> </header> </div> <div class="col-xs-6 col-sm-3 cta__item"> <figure> <?= $this->Html->image( '/frontend/dist/images/icon-house.svg', [ 'alt' => __( '' ), 'fullBase' => true ] ) ?> </figure> <header> <h4>Installatie van de panelen in 1 dag.</h4> </header> </div> <div class="col-xs-6 col-sm-3 cta__item"> <figure> <?= $this->Html->image( '/frontend/dist/images/icon-bolt.svg', [ 'alt' => __( '' ), 'fullBase' => true ] ) ?> </figure> <header> <h4>Over enkele weken maakt u zelf stroom</h4> </header> </div> </div> </div> </div> </section> <?php } ?> <?php if ( ! isset( $isPdf ) ): $this->Cell( 'Reviews' ); endif; ?> </div> <?php if ( isset( $isPdf ) ): ?> <div class="pdfpagebreak"></div> <?php $confirmTemplate = 'koop'; if ( $chosenQuoteTemplate == 'rent' || $chosenQuoteTemplate == 'a1h' ) { $confirmTemplate = 'huur'; } $cellSectionConfirm = $this->Cell( 'Confirm', [ $quote, $chosenQuotePackage, $chosenQuoteType, $chosenQuoteTemplate, $termsOfConditions ] ); echo $cellSectionConfirm->render( 'confirm_' . $confirmTemplate ); endif; ?> </main> <?php if ( ! isset( $isPdf ) ): echo $this->Cell( 'Footer' ); endif; ?> <!-- Appointments modal --> <div class="modal fade" id="appointmentModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button> <h4 class="modal-title" id="myModalLabel"> <?= __( "Let's make an appointment" ); ?> </h4> </div> <div class="modal-body"> <div class="appointmentPicker"> <div id="JQueryAppointmentCalendar_1" class="JQueryAppointmentCalendar"></div> <div class="appointmentLoader"></div> <div id="JQueryAppointmentTimes_1" class="JQueryAppointmentTimes"> <div class="messages"></div> <div class="times"></div> </div> <div id="JQueryAppointmentSummary_1" class="JQueryAppointmentSummary"> <div class="messages"></div> </div> <div id="JQueryAppointmentFinished_1" class="JQueryAppointmentFinished"> <div class="messages"> </div> </div> </div> </div> <div class="modal-footer"> <button type="button" class="button appointment--close" data-dismiss="modal"> <span><?= __( 'Not now' ); ?></span> </button> <button type="button" class="button button--blue button--icon appointment--make"> <span><?= __( "Make appointment" ); ?></span> </button> </div> </div> </div> </div> <script> ... </script> TEXT; $dom=new DOMDocument; libxml_use_internal_errors(true); // for malformed html warning suppression $dom->loadHTML($text, LIBXML_NOENT); //libxml_clear_errors(); // for warning suppression $xpath = new DOMXPath($dom); foreach ($xpath->query("//*[@data-edit='true' and @data-type and @data-name]") as $node) { $results[] = [ 'type' => $node->getAttribute('data-type'), 'name' => $node->getAttribute('data-name'), 'text' => $node->textContent ]; } var_export($results);
Output for 5.6.38, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
array ( 0 => array ( 'type' => 'wysiwyg', 'name' => 'Beoordeling', 'text' => 'We beoordelen uw aanvraag en berichten u over de acceptatie daarvan.', ), 1 => array ( 'type' => 'text', 'name' => 'Bellen', 'text' => 'We bellen u voor een afspraak.', ), 2 => array ( 'type' => 'text', 'name' => 'Technisch specialist', 'text' => 'Technisch specialist neemt bij u alles nog even door.', ), )

preferences:
155.98 ms | 409 KiB | 5 Q