3v4l.org

run code in 300+ PHP versions simultaneously
<?php #[AllowDynamicProperties] final class WP_Term { /** * Term ID. * * @since 4.4.0 * @var int */ public $term_id; /** * The term's name. * * @since 4.4.0 * @var string */ public $name = ''; /** * The term's slug. * * @since 4.4.0 * @var string */ public $slug = ''; /** * The term's term_group. * * @since 4.4.0 * @var int */ public $term_group = ''; /** * Term Taxonomy ID. * * @since 4.4.0 * @var int */ public $term_taxonomy_id = 0; /** * The term's taxonomy name. * * @since 4.4.0 * @var string */ public $taxonomy = ''; /** * The term's description. * * @since 4.4.0 * @var string */ public $description = ''; /** * ID of a term's parent term. * * @since 4.4.0 * @var int */ public $parent = 0; /** * Cached object count for this term. * * @since 4.4.0 * @var int */ public $count = 0; /** * Stores the term object's sanitization level. * * Does not correspond to a database field. * * @since 4.4.0 * @var string */ public $filter = 'raw'; /** * Constructor. * * @since 4.4.0 * * @param WP_Term|object $term Term object. */ public function __construct( $term ) { foreach ( get_object_vars( $term ) as $key => $value ) { $this->$key = $value; } } /** * Sanitizes term fields, according to the filter type provided. * * @since 4.4.0 * * @param string $filter Filter context. Accepts 'edit', 'db', 'display', 'attribute', 'js', 'rss', or 'raw'. */ public function filter( $filter ) { sanitize_term( $this, $this->taxonomy, $filter ); } /** * Converts an object to array. * * @since 4.4.0 * * @return array Object as array. */ public function to_array() { return get_object_vars( $this ); } /** * Getter. * * @since 4.4.0 * * @param string $key Property to get. * @return mixed Property value. */ public function __get( $key ) { switch ( $key ) { case 'data': $data = new stdClass(); $columns = array( 'term_id', 'name', 'slug', 'term_group', 'term_taxonomy_id', 'taxonomy', 'description', 'parent', 'count' ); foreach ( $columns as $column ) { $data->{$column} = isset( $this->{$column} ) ? $this->{$column} : null; } return $data; // return sanitize_term( $data, $data->taxonomy, 'raw' ); } } } $data = (object) array( 'term_id' => 1, 'name' => 'Uncategorized', 'slug' => 'uncategorized', 'term_group' => 0, 'term_taxonomy_id' => 1, 'taxonomy' => 'category', 'description' => '', 'parent' => 1, 'count' => 1, ); $term = new WP_Term( $data ); echo '$term->data ...' . "\n\n"; var_dump( $term->data ); echo "\n\n" . '(array) $term->data ...' . "\n\n"; var_dump( (array) $term->data ); echo "\n\n" . '$term->to_array() ...' . "\n\n"; var_dump( $term->to_array() );

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.110.0130.00720.94
8.3.100.0070.01316.74
8.3.90.0100.00726.77
8.3.80.0090.00017.97
8.3.70.0100.00616.88
8.3.60.0150.00716.82
8.3.50.0160.00716.73
8.3.40.0160.00321.97
8.3.30.0110.00718.61
8.3.20.0110.00621.72
8.3.10.0110.00721.86
8.3.00.0080.01318.89
8.2.230.0030.00622.58
8.2.220.0100.01024.06
8.2.210.0050.00526.77
8.2.200.0070.00316.63
8.2.190.0110.00716.75
8.2.180.0070.01416.63
8.2.170.0040.01219.09
8.2.160.0190.00918.86
8.2.150.0130.00719.05
8.2.140.0110.00620.34
8.2.130.0110.00720.29
8.2.120.0080.01119.28
8.2.110.0170.00019.29
8.2.100.0170.00618.97
8.2.90.0140.00618.85
8.2.80.0100.00819.28
8.2.70.0170.00318.81
8.2.60.0160.00318.81
8.2.50.0120.00718.95
8.2.40.0150.00518.94
8.2.30.0130.00518.80
8.2.20.0160.00818.80
8.2.10.0110.00918.80
8.2.00.0180.00818.86
8.1.290.0060.00330.84
8.1.280.0100.01325.92
8.1.270.0070.01022.11
8.1.260.0060.01222.02
8.1.250.0080.01022.10
8.1.240.0150.01018.54
8.1.230.0140.00818.48
8.1.220.0130.00718.78
8.1.210.0130.00718.42
8.1.200.0150.00618.73
8.1.190.0120.00918.82
8.1.180.0140.00618.39
8.1.170.0090.01018.75
8.1.160.0120.00818.52
8.1.150.0060.01718.76
8.1.140.0190.00518.46
8.1.130.0070.01218.75
8.1.120.0160.00818.60
8.1.110.0180.00718.29
8.1.100.0110.01119.71
8.1.90.0180.00518.43
8.1.80.0170.00619.60
8.1.70.0070.01418.54
8.1.60.0180.00518.75
8.1.50.0170.00718.45
8.1.40.0200.00518.58
8.1.30.0100.00718.88
8.1.20.0170.00719.89
8.1.10.0150.00918.65
8.1.00.0220.00318.46
8.0.300.0130.00517.98
8.0.290.0200.00417.67
8.0.280.0210.00717.80
8.0.270.0110.00517.89
8.0.260.0220.00517.85
8.0.250.0180.00917.70
8.0.240.0250.00317.76
8.0.230.0170.00818.02
8.0.220.0140.00817.94
8.0.210.0200.00817.71
8.0.200.0200.01118.04
8.0.190.0250.00717.88
8.0.180.0160.00717.96
8.0.170.0210.00917.75
8.0.160.0120.00718.05
8.0.150.0230.00917.88
8.0.140.0230.00617.91
8.0.130.0200.00717.89
8.0.120.0220.00817.75
8.0.110.0220.00717.79
8.0.100.0160.00817.78
8.0.90.0210.00817.86
8.0.80.0240.00717.71
8.0.70.0120.00517.90
8.0.60.0240.00517.83
8.0.50.0230.00317.97
8.0.30.0110.00518.03
8.0.20.0090.00717.92
8.0.10.0130.01317.92
8.0.00.0190.00719.56
7.4.330.0190.00817.43
7.4.320.0280.00317.52
7.4.300.0240.00717.53
7.4.290.0230.00717.53
7.4.280.0270.00717.53
7.4.270.0200.01117.43
7.4.260.0250.00617.52
7.4.250.0220.01217.51
7.4.240.0260.00517.43
7.4.230.0290.00417.58
7.4.220.0210.01017.43
7.4.210.0230.00817.46
7.4.200.0250.00517.43
7.4.190.0230.00517.44
7.4.180.0230.00617.56
7.4.160.0200.01217.64
7.4.150.0230.01017.43
7.4.140.0200.01017.45
7.4.130.0210.00817.44
7.4.120.0220.00917.43
7.4.110.0270.00517.43
7.4.100.0260.00517.43
7.4.90.0260.00417.43
7.4.80.0200.01017.43
7.4.70.0270.00417.46
7.4.60.0230.00717.45
7.4.50.0250.00617.43
7.4.40.0250.00517.43
7.4.30.0280.00517.43
7.4.20.0210.01017.43
7.4.10.0220.00817.43
7.4.00.0210.01017.46
7.3.330.0220.00817.47
7.3.320.0230.00817.43
7.3.310.0230.00717.45
7.3.300.0220.00617.84
7.3.290.0280.00217.43
7.3.280.0210.00617.43
7.3.270.0230.00617.43
7.3.260.0200.01017.43
7.3.250.0220.00717.43
7.3.240.0250.00617.43
7.3.230.0260.00417.43
7.3.220.0200.00917.43
7.3.210.0200.01117.43
7.3.200.0210.01017.43
7.3.190.0230.00617.43
7.3.180.0210.01117.43
7.3.170.0210.00817.79
7.3.160.0260.00417.43
7.3.150.0280.00317.43
7.3.140.0200.00717.43
7.3.130.0210.01017.43
7.3.120.0240.00417.43
7.3.110.0130.01117.54
7.3.100.0190.00717.43
7.3.90.0190.00817.52
7.3.80.0210.00717.45
7.3.70.0160.00717.70
7.3.60.0230.00617.47
7.3.50.0200.00917.43
7.3.40.0210.00517.49
7.3.30.0160.01217.44
7.3.20.0220.00917.43
7.3.10.0210.00917.43
7.3.00.0250.00617.43
7.2.340.0230.00517.43
7.2.330.0220.00917.43
7.2.320.0170.01117.43
7.2.310.0210.00717.43
7.2.300.0190.01017.60
7.2.290.0240.00517.45
7.2.280.0210.00617.46
7.2.270.0190.01017.43
7.2.260.0190.01217.46
7.2.250.0220.00517.43
7.2.240.0230.00617.43
7.2.230.0220.00617.43
7.2.220.0220.00817.45
7.2.210.0240.00617.44
7.2.200.0250.00617.67
7.2.190.0240.00517.45
7.2.180.0240.00917.48
7.2.170.0230.00717.46
7.2.160.0190.01217.43
7.2.150.0380.00717.52
7.2.140.0490.00217.56
7.2.130.0280.00317.59
7.2.120.0240.00617.47
7.2.110.0280.00317.70
7.2.100.0130.00517.53
7.2.90.0260.00617.47
7.2.80.0250.00517.46
7.2.70.0250.00417.60
7.2.60.0230.00817.43
7.2.50.0260.00617.53
7.2.40.0260.00517.57
7.2.30.0270.00417.63
7.2.20.0230.00717.64
7.2.10.0250.00317.61
7.2.00.0130.00717.64
7.1.330.0240.00317.43
7.1.320.0230.00517.43
7.1.310.0200.00617.43
7.1.300.0200.00817.43
7.1.290.0190.00917.43
7.1.280.0190.00817.43
7.1.270.0370.00617.51
7.1.260.0350.00817.43
7.1.250.0240.00517.43
7.1.240.0190.00917.43
7.1.230.0220.00417.43
7.1.220.0220.00517.43
7.1.210.0190.00717.43
7.1.200.0220.00817.43
7.1.190.0240.00417.43
7.1.180.0280.00017.43
7.1.170.0210.00617.43
7.1.160.0210.00817.43
7.1.150.0190.00717.43
7.1.140.0230.00517.43
7.1.130.0220.00617.43
7.1.120.0190.00917.43
7.1.110.0220.00417.43
7.1.100.0200.00617.43
7.1.90.0170.01117.43
7.1.80.0190.00817.43
7.1.70.0180.00817.43
7.1.60.0250.00217.43
7.1.50.0290.00617.43
7.1.40.0340.01017.43
7.1.30.0240.00417.43
7.1.20.0180.01117.43
7.1.10.0260.00117.43
7.1.00.0130.00417.43
7.0.330.0200.00517.43
7.0.320.0230.00217.43
7.0.310.0190.00617.43
7.0.300.0280.00117.43
7.0.290.0170.00917.43
7.0.280.0220.00517.43
7.0.270.0190.00817.43
7.0.260.0230.00417.43
7.0.250.0220.00517.43
7.0.240.0220.00517.43
7.0.230.0190.00817.43
7.0.220.0200.00817.43
7.0.210.0170.00817.43
7.0.200.0190.00917.43
7.0.190.0190.00817.43
7.0.180.0230.00517.43
7.0.170.0310.01217.43
7.0.160.0390.00717.43
7.0.150.0210.00617.43
7.0.140.0180.00917.43
7.0.130.0230.00317.43
7.0.120.0240.00517.43
7.0.110.0170.00817.43
7.0.100.0190.00217.43
7.0.90.0090.00817.43
7.0.80.0200.00317.43
7.0.70.0140.01117.43
7.0.60.0110.00517.43
7.0.50.0080.00917.43
7.0.40.0160.00717.43
7.0.30.0080.00717.43
7.0.20.0240.00617.43
7.0.10.0290.00017.43
7.0.00.0130.01117.43
5.6.400.0220.00317.43
5.6.390.0210.00517.43
5.6.380.0170.00617.43
5.6.370.0200.00517.43
5.6.360.0180.00817.43
5.6.350.0200.00717.43
5.6.340.0230.00417.43
5.6.330.0210.00917.43
5.6.320.0240.00117.43
5.6.310.0230.00117.43
5.6.300.0230.00517.43
5.6.290.0210.00517.43
5.6.280.0230.00517.43
5.6.270.0260.00417.43
5.6.260.0230.00417.43
5.6.250.0140.01317.43
5.6.240.0190.00717.43
5.6.230.0180.00817.43
5.6.220.0190.00717.43
5.6.210.0200.00417.43
5.6.200.0210.00517.43
5.6.190.0210.00617.43
5.6.180.0150.01017.43
5.6.170.0140.01117.43
5.6.160.0220.00517.43
5.6.150.0180.00617.43
5.6.140.0190.00617.43
5.6.130.0180.00717.43
5.6.120.0170.01017.43
5.6.110.0190.00717.43
5.6.100.0210.00617.43
5.6.90.0230.00417.43
5.6.80.0190.00617.43
5.6.70.0240.00117.43
5.6.60.0150.01117.43
5.6.50.0140.00817.43
5.6.40.0150.00817.43
5.6.30.0190.00517.43
5.6.20.0180.00817.43
5.6.10.0180.00717.43
5.6.00.0200.00317.43
5.5.380.0190.00817.43
5.5.370.0180.00817.43
5.5.360.0210.00417.43
5.5.350.0150.01017.43
5.5.340.0200.00817.43
5.5.330.0160.01017.43
5.5.320.0190.00817.43
5.5.310.0230.00517.43
5.5.300.0270.00217.43
5.5.290.0210.00517.43
5.5.280.0140.01317.43
5.5.270.0210.00417.43
5.5.260.0230.00417.43
5.5.250.0210.00617.43
5.5.240.0160.01117.43
5.5.230.0220.00517.43
5.5.220.0140.01117.43
5.5.210.0200.00617.43
5.5.200.0210.00517.43
5.5.190.0160.00917.43
5.5.180.0210.00717.43
5.5.170.0220.00617.43
5.5.160.0200.00617.43
5.5.150.0230.00417.43
5.5.140.0160.01117.43
5.5.130.0250.00217.43
5.5.120.0230.00217.43
5.5.110.0160.01017.43
5.5.100.0190.00917.43
5.5.90.0190.00717.43
5.5.80.0230.00417.43
5.5.70.0200.00717.43
5.5.60.0210.00617.43
5.5.50.0180.00717.43
5.5.40.0170.01017.43
5.5.30.0180.00817.43
5.5.20.0200.00717.43
5.5.10.0250.00217.43
5.5.00.0190.00917.43
5.4.450.0200.00317.43
5.4.440.0220.00217.43
5.4.430.0200.00317.43
5.4.420.0180.00517.43
5.4.410.0180.00617.43
5.4.400.0190.00517.43
5.4.390.0190.00517.43
5.4.380.0170.00617.43
5.4.370.0190.00417.43
5.4.360.0190.00517.43
5.4.350.0160.00817.43
5.4.340.0220.00217.43
5.4.330.0170.00717.43
5.4.320.0210.00317.43
5.4.310.0180.00617.43
5.4.300.0210.00317.43
5.4.290.0230.00217.43
5.4.280.0130.00917.43
5.4.270.0160.00517.43
5.4.260.0180.00517.43
5.4.250.0200.00517.43
5.4.240.0180.00617.43
5.4.230.0170.00817.43
5.4.220.0180.00317.43
5.4.210.0180.00617.43
5.4.200.0230.00317.43
5.4.190.0180.00517.43
5.4.180.0220.00517.43
5.4.170.0200.00517.43
5.4.160.0210.00317.43
5.4.150.0180.00717.43
5.4.140.0180.00617.43
5.4.130.0160.00717.43
5.4.120.0160.00517.43
5.4.110.0210.00317.43
5.4.100.0170.00517.43
5.4.90.0220.00117.43
5.4.80.0170.00317.43
5.4.70.0170.00317.43
5.4.60.0110.00217.43
5.4.50.0060.00617.43
5.4.40.0040.00817.43
5.4.30.0070.00417.43
5.4.20.0080.00417.43
5.4.10.0120.00017.43
5.4.00.0080.00517.43
5.3.290.0060.00517.43
5.3.280.0090.00317.43
5.3.270.0080.00317.43
5.3.260.0120.00017.43
5.3.250.0080.00517.43
5.3.240.0050.00717.43
5.3.230.0070.00517.43
5.3.220.0050.00817.43
5.3.210.0080.00417.43
5.3.200.0090.00317.43
5.3.190.0050.00617.43
5.3.180.0090.00317.43
5.3.170.0060.00617.43
5.3.160.0040.00917.43
5.3.150.0040.00717.43
5.3.140.0100.00217.43
5.3.130.0100.00217.43
5.3.120.0030.00817.43
5.3.110.0090.00317.43
5.3.100.0090.00317.43
5.3.90.0050.00717.43
5.3.80.0080.00517.43
5.3.70.0040.00817.43
5.3.60.0050.00817.43
5.3.50.0090.00317.43
5.3.40.0070.00417.43
5.3.30.0080.00417.43
5.3.20.0060.00717.43
5.3.10.0030.00817.43
5.3.00.0040.00917.43
5.2.170.0110.00017.43
5.2.160.0060.00417.43
5.2.150.0080.00317.43
5.2.140.0070.00317.43
5.2.130.0080.00517.43
5.2.120.0050.00617.43
5.2.110.0050.00517.43
5.2.100.0100.00117.43
5.2.90.0020.00917.43
5.2.80.0100.00217.43
5.2.70.0040.00717.43
5.2.60.0060.00617.43
5.2.50.0040.00817.43
5.2.40.0080.00317.43
5.2.30.0130.00317.43
5.2.20.0080.00817.43
5.2.10.0130.00417.43
5.2.00.0120.00517.43
5.1.60.0120.00317.43
5.1.50.0080.00717.43
5.1.40.0110.00317.43
5.1.30.0130.00217.43
5.1.20.0060.01017.43
5.1.10.0100.00517.43
5.1.00.0110.00317.43
5.0.50.0130.00017.43
5.0.40.0060.00617.43
5.0.30.0100.00317.43
5.0.20.0080.00417.43
5.0.10.0110.00217.43
5.0.00.0100.00217.43
4.4.90.0070.00017.43
4.4.80.0070.00017.43
4.4.70.0040.00417.43
4.4.60.0030.00417.43
4.4.50.0070.00017.43
4.4.40.0050.00217.43
4.4.30.0030.00417.43
4.4.20.0050.00217.43
4.4.10.0080.00017.43
4.4.00.0070.00017.43
4.3.110.0050.00217.43
4.3.100.0070.00017.43
4.3.90.0040.00317.43
4.3.80.0060.00017.43
4.3.70.0060.00217.43
4.3.60.0020.00417.43
4.3.50.0070.00017.43
4.3.40.0070.00017.43
4.3.30.0060.00017.43
4.3.20.0040.00217.43
4.3.10.0040.00117.43
4.3.00.0060.00017.43

preferences:
31.39 ms | 403 KiB | 5 Q