3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '<?xml version="1.0" encoding="UTF-8"?> <DATA> <sessionId>1073741(eA14011269142xC071</sessionId> <device_id></device_id> <sessionTime>1429457223</sessionTime> <trans_time>1429457223</trans_time> <mpb>1000</mpb> <user_id>1335</user_id> <user_name>ltt1835</user_name> <alias>Lotto8 陈</alias> <display_user_points>3999</display_user_points> <message>剩余积分不足, 请充值后再继续。</message> <transfer_points>0</transfer_points> <user_points>3999</user_points> <fund_status>100</fund_status> <Jackpot> <jackpot_amount>1582668</jackpot_amount> <jackpot_ceiling>10000</jackpot_ceiling> <jackpot_preserved>800000</jackpot_preserved> <message_front>总奖池目前已经高达</message_front> <message_mid>分,大奖随时开出,多玩多赢。</message_mid> <message_end></message_end> <message_top>两次开奖,奖上有奖,喜上加喜</message_top> </Jackpot> <card_number>1073741835</card_number> <status>1</status> </DATA>'; print_r( get_tag("status", "1", $str)); function get_tag( $attr, $value, $xml, $tag=null ) { if( is_null($tag) ) $tag = '\w+'; else $tag = preg_quote($tag); $attr = preg_quote($attr); $value = preg_quote($value); $tag_regex = "/<(".$tag.")[^>]*$attr\s*=\s*". "(['\"])$value\\2[^>]*>(.*?)<\/\\1>/"; preg_match_all($tag_regex, $xml, $matches, PREG_PATTERN_ORDER); return $matches[3]; } ?>
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 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.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
Array ( )
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Array ( )

preferences:
289.55 ms | 401 KiB | 459 Q